Closed csuwildcat closed 3 years ago
All of them must be Uint8Array
. Uint8Array.from
does not decode base64, you need a decoder/encoder, for example @stablelib/base64
(doc)
Yep, my bad, I just blanked and didn't even remember to decode the values.
Aside: might still be good to reference the type of args for calls in the MD (maybe link the text to a common statement that all are Uint8Array?)
If you want, I can submit a PR to link the arg names to that section, but understand if you think that's overkill. Just lmk.
Yeah, I think it would be overkill and wouldn't look nice in plaintext. Thanks anyway!
I have been struggling with errors that report
TypeError: unexpected type, use Uint8Array
, but I can't figure out which arguments it pertains to and the docs don't seem to provide an indication of which arguments expect which types. I have tried generating Uint8Array values for just about every method I am invoking, but haven't had any luck. The offending line of my code is this:return nacl.sign.detached.verify(Uint8Array.from(message), Uint8Array.from(signature), publicKey);
In my code,
message
is a base64Url encoded hash of an image's raw buffer, andsignature
is a base64Url encoded version of the signature tweetnacl outputs. Any insight would be much appreciated.