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 #92 from sevki/patch-1
Browse files Browse the repository at this point in the history
check if window exist
  • Loading branch information
alokmenghrajani committed Apr 12, 2019
2 parents 46050db + 8006871 commit 6d829c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/jose-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ export var setCrypto = function (cp) {
/**
* Default to the global "crypto" variable
*/
if (typeof(window.crypto) !== 'undefined') {
setCrypto(window.crypto);
if(!crypto.subtle){ crypto.subtle = crypto.webkitSubtle; }
}
if (typeof window !== "undefined") {
if (typeof window.crypto !== "undefined") {
setCrypto(window.crypto);
if (!crypto.subtle) {
crypto.subtle = crypto.webkitSubtle;
}
}
}

/**
* Use Node versions of atob, btoa functions outside the browser
Expand Down

0 comments on commit 6d829c3

Please sign in to comment.