let textBytes = ctypes.uint8_t("hello");
let a = new SECItem;
a.type = siBuffer;
a.data = textBytes.address();
a.len = textBytes.length;
I got ReferenceError: can't access lexical declaration textBytes before initialization.
let textBytes = ctypes.uint8_t("hello");
let a = new SECItem;
a.type = siBuffer;
a.data = textBytes.address();
a.len = textBytes.length;
I got ReferenceError: can't access lexical declaration textBytes before initialization.
I can't reproduce the reference error you are getting, but I think change
as this throws
TypeError: expected type uint8_t, got "hello"
toThis will give you a null-terminated string, of length 6. If you want it to be length 5, no null termination then do
let textBytes = ctypes.uint8_t.array(5)("hello");
as I am thinking, change
to
or
let a = new SECItem();
they are both same.If that doesn't fix it, please share the structure of
SECItem
and what issiBuffer
.