Browse Source

bugfix: sha2 must return Uint8Array, not ArrayBuffer

main
AJ ONeal 2 years ago
parent
commit
af7ee5426f
  1. 4
      lib/browser/sha2.js

4
lib/browser/sha2.js

@ -9,5 +9,7 @@ sha2.sum = function (alg, str) {
data = encoder.encode(str);
}
var sha = 'SHA-' + String(alg).replace(/^sha-?/i, '');
return window.crypto.subtle.digest(sha, data);
return window.crypto.subtle.digest(sha, data).then(function (buf) {
return new Uint8Array(buf);
});
};

Loading…
Cancel
Save