1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-11-14 07:49:02 +01:00

Updated WebCrypto-shim library

This commit is contained in:
Giulio Cesare Solaroli 2017-09-16 09:41:03 +02:00
parent bc92cbce63
commit 58e89852c3

View File

@ -19,8 +19,9 @@
_SubtleCrypto = global.SubtleCrypto || _subtle.constructor || Object,
_CryptoKey = global.CryptoKey || global.Key || Object;
var isIE = !!global.msCrypto,
isWebkit = !!_crypto.webkitSubtle;
var isEdge = global.navigator.userAgent.indexOf('Edge/') > -1;
var isIE = !!global.msCrypto && !isEdge;
var isWebkit = !_crypto.subtle && !!_crypto.webkitSubtle;
if ( !isIE && !isWebkit ) return;
function s2a ( s ) {
@ -360,7 +361,7 @@
keys[0].alg = keys[1].alg = jwkAlg(ka);
keys[0].key_ops = ku.filter(isPubKeyUse), keys[1].key_ops = ku.filter(isPrvKeyUse);
return Promise.all([
_subtle.importKey( 'jwk', keys[0], ka, kx, keys[0].key_ops ),
_subtle.importKey( 'jwk', keys[0], ka, true, keys[0].key_ops ),
_subtle.importKey( 'jwk', keys[1], ka, kx, keys[1].key_ops ),
]);
})
@ -594,4 +595,4 @@
global.SubtleCrypto = _SubtleCrypto;
global.CryptoKey = CryptoKey;
}
}(this);
}( typeof window === 'undefined' ? typeof self === 'undefined' ? this : self : window );