diff --git a/lib/jose-utils.js b/lib/jose-utils.js index f8d6510..624a867 100644 --- a/lib/jose-utils.js +++ b/lib/jose-utils.js @@ -367,5 +367,15 @@ Utils.sha256 = function(str) { Utils.isCryptoKey = function(rsa_key) { // Some browsers don't expose the CryptoKey as an object, so we need to check // the constructor's name. - return rsa_key.constructor.name == 'CryptoKey'; + if (rsa_key.constructor.name == 'CryptoKey') { + return true; + } + + // In the presence of minifiers, relying on class names can be problematic, + // so let's also allow objects that have an 'algorithm' property. + if (rsa_key.hasOwnProperty('algorithm')) { + return true; + } + + return false; };