mobile safari webcrypto fix
This commit is contained in:
parent
ec529d807a
commit
07ac4004b8
|
@ -13,7 +13,7 @@ exports.sha1Hmac = function (key, bytes) {
|
||||||
var Unibabel = window.Unibabel;
|
var Unibabel = window.Unibabel;
|
||||||
|
|
||||||
if (window.crypto) {
|
if (window.crypto) {
|
||||||
return window.crypto.subtle.importKey(
|
return (window.crypto.subtle||window.crypto.webkitSubtle).importKey(
|
||||||
"raw"
|
"raw"
|
||||||
, key
|
, key
|
||||||
, { name: "HMAC"
|
, { name: "HMAC"
|
||||||
|
@ -41,7 +41,7 @@ exports.sha1Hmac = function (key, bytes) {
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
.then(function (key) {
|
.then(function (key) {
|
||||||
return window.crypto.subtle.sign(
|
return (window.crypto.subtle||window.crypto.webkitSubtle).sign(
|
||||||
{ name: "HMAC" }
|
{ name: "HMAC" }
|
||||||
, key // from generateKey or importKey above
|
, key // from generateKey or importKey above
|
||||||
, new Uint8Array(bytes) // ArrayBuffer of data you want to sign
|
, new Uint8Array(bytes) // ArrayBuffer of data you want to sign
|
||||||
|
|
Loading…
Reference in New Issue