This commit is contained in:
Manav Rathi 2024-05-24 13:49:21 +05:30
parent 0ec75c2435
commit fffe96a4c7
No known key found for this signature in database

View file

@ -62,10 +62,10 @@ const uintToArray = (n: number): Uint8Array => {
return result; return result;
}; };
// We don't necessarily need this dependency, we could use SubtleCrypto here // We don't necessarily need a dependency on `jssha`, we could use SubtleCrypto
// instead too. However, SubtleCrypto has an async interface, and we already // here too. However, SubtleCrypto has an async interface, and we already have a
// have a transitive dependency on jssha via otpauth, so just using it here // transitive dependency on `jssha` via `otpauth`, so just using it here doesn't
// doesn't increase our bundle size any further. // increase our bundle size any further.
const sha1HMACDigest = (key: ArrayBuffer, message: Uint8Array) => { const sha1HMACDigest = (key: ArrayBuffer, message: Uint8Array) => {
const hmac = new jsSHA("SHA-1", "UINT8ARRAY"); const hmac = new jsSHA("SHA-1", "UINT8ARRAY");
hmac.setHMACKey(key, "ARRAYBUFFER"); hmac.setHMACKey(key, "ARRAYBUFFER");