Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #50 from rapropos/loosencryptokey
Browse files Browse the repository at this point in the history
Allow CryptoKey to be recognized even when provided by minified applications
  • Loading branch information
alokmenghrajani authored Oct 21, 2016
2 parents 9a68e0d + 3f3f0f7 commit e505e6b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/jose-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit e505e6b

Please sign in to comment.