You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this library in a browser, to decode an hmac signature in base64.
// This line crashes:constsig=decode("s11AVt9BuoYTNNOSS8oS9TzUeh0");constbytes=newTextEncoder().encode(sig);constverified=awaitcrypto.subtle.verify("HMAC",key,signature,bytes,);
The result:
URIError: URI malformed
at decodeURIComponent (<anonymous>)
at decode2 (index.js:67:14)
at decodeAndVerifyUrl (index.js:83:62)
at Object.handleFetch [as fetch] (index.js:131:23) {
stack: URIError: URI malformed
at decodeURIComponent …t Object.handleFetch [as fetch] (index.js:131:23),
message: URI malformed
}
Also, curious if I'm doing this all wrong and you know an easier way to get a base64 signature into raw bytes.
The text was updated successfully, but these errors were encountered:
This library converts a string to a string, I'd just use this directly instead: https://github.com/borderless/base64. It converts between ArrayBuffer directly so no need to encode/decode, which should eliminate this bug too.
I'm using this library in a browser, to decode an hmac signature in base64.
The result:
Also, curious if I'm doing this all wrong and you know an easier way to get a base64 signature into raw bytes.
The text was updated successfully, but these errors were encountered: