2
0
mirror of https://github.com/therootcompany/keypairs.js synced 2025-04-20 06:20:38 +00:00

bugfix: sha2 must return Uint8Array, not ArrayBuffer

This commit is contained in:
AJ ONeal 2020-08-20 01:02:18 -06:00
parent c66e9267aa
commit af7ee5426f

View File

@ -9,5 +9,7 @@ sha2.sum = function (alg, str) {
data = encoder.encode(str); data = encoder.encode(str);
} }
var sha = 'SHA-' + String(alg).replace(/^sha-?/i, ''); 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);
});
}; };