mobile safari webcrypto fix

This commit is contained in:
AJ ONeal 2015-10-23 02:19:32 -07:00
parent ec529d807a
commit 07ac4004b8
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ exports.sha1Hmac = function (key, bytes) {
var Unibabel = window.Unibabel;
if (window.crypto) {
return window.crypto.subtle.importKey(
return (window.crypto.subtle||window.crypto.webkitSubtle).importKey(
"raw"
, key
, { name: "HMAC"
@ -41,7 +41,7 @@ exports.sha1Hmac = function (key, bytes) {
)
*/
.then(function (key) {
return window.crypto.subtle.sign(
return (window.crypto.subtle||window.crypto.webkitSubtle).sign(
{ name: "HMAC" }
, key // from generateKey or importKey above
, new Uint8Array(bytes) // ArrayBuffer of data you want to sign