Skip to content

Commit c32f182

Browse files
committed
Renamed webCrypto to more precise browserCrypto
1 parent 9aa1f14 commit c32f182

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

generate-ip/src/generate-ip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ let randomInt;
88
try { // to use Node.js module
99
({ randomInt } = require('crypto'));
1010
} catch (err) { // use browser API or JS method
11-
const webCrypto = window.crypto || window.msCrypto;
11+
const browserCrypto = window.crypto || window.msCrypto;
1212
randomInt = (min, max) => {
13-
const randomVal = webCrypto?.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF || Math.random();
13+
const randomVal = browserCrypto?.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF || Math.random();
1414
return Math.floor(randomVal * (max - min)) + min;
1515
};
1616
}

generate-pw/src/generate-pw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ try { // to use Node.js module
99
({ randomInt } = require('crypto'));
1010
} catch (err) { // use browser API or JS method
1111
console.error('could not iport crcypto');
12-
const webCrypto = window.crypto || window.msCrypto;
12+
const browserCrypto = window.crypto || window.msCrypto;
1313
randomInt = (min, max) => {
14-
const randomVal = webCrypto?.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF || Math.random();
14+
const randomVal = browserCrypto?.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF || Math.random();
1515
return Math.floor(randomVal * (max - min)) + min;
1616
};
1717
}

0 commit comments

Comments
 (0)