Skip to content

Commit

Permalink
Improve compatibility with additional runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
zigazajc007 committed Sep 19, 2024
1 parent 5e00ecc commit 9aec58f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/index.js

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

2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rabbit-company/password-generator",
"version": "2.1.1",
"version": "2.2.0",
"exports": "./src/password-generator.ts",
"publish": {
"include": ["LICENSE", "README.md", "src/password-generator.ts"]
Expand Down
2 changes: 1 addition & 1 deletion module/password-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var PasswordGenerator;
var maxNum = Math.pow(256, requestBytes);
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];
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rabbit-company/password-generator",
"version": "2.1.1",
"version": "2.2.0",
"description": "Password generator",
"main": "./module/password-generator.js",
"browser": "./module/password-generator.js",
Expand Down Expand Up @@ -35,11 +35,11 @@
"strength"
],
"devDependencies": {
"@types/bun": "^1.1.7",
"@types/bun": "^1.1.9",
"bun-plugin-dts": "^0.2.3",
"@rabbit-company/logger": "^4.0.0"
},
"peerDependencies": {
"typescript": "^5.5.4"
"typescript": "^5.6.2"
}
}
2 changes: 1 addition & 1 deletion src/password-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace PasswordGenerator {
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

0 comments on commit 9aec58f

Please sign in to comment.