From 58e89852c32d9258ed43903e1fc929ce900eb118 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Sat, 16 Sep 2017 09:41:03 +0200 Subject: [PATCH] Updated WebCrypto-shim library --- frontend/delta/js/WebcryptoShim/webcrypto-shim.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/delta/js/WebcryptoShim/webcrypto-shim.js b/frontend/delta/js/WebcryptoShim/webcrypto-shim.js index 78b68c5..3769335 100644 --- a/frontend/delta/js/WebcryptoShim/webcrypto-shim.js +++ b/frontend/delta/js/WebcryptoShim/webcrypto-shim.js @@ -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 ); \ No newline at end of file