Skip to content

Commit

Permalink
Merge pull request #2 from MichailiK/main
Browse files Browse the repository at this point in the history
Replace `window` with `globalThis`
  • Loading branch information
zigazajc007 authored Sep 19, 2024
2 parents d54ed54 + 3f121e4 commit cc54fe4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion browser/argon2id.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions module/argon2id.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/argon2id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace Argon2id {
var ar = new Uint8Array(requestBytes);

while (true) {
window.crypto.getRandomValues(ar);
globalThis.crypto.getRandomValues(ar);
var val = 0;
for (var i = 0; i < requestBytes; i++) val = (val << 8) + ar[i];
if (val < maxNum - (maxNum % range)) return min + (val % range);
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace Argon2id {
};

try {
if (!window.Worker) return fallbackToWasm();
if (!globalThis.Worker) return fallbackToWasm();

const response = await fetch("argon2id_worker.js", { method: "HEAD" });
if (!response.ok) return fallbackToWasm();
Expand Down

0 comments on commit cc54fe4

Please sign in to comment.