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

Commit

Permalink
fix: remove crypto dependency for browser compatibility (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleOTheven authored Jun 26, 2023
1 parent c15df74 commit 5aa9d56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
5 changes: 4 additions & 1 deletion packages/useink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"React",
"hooks"
],
"version": "1.9.1",
"version": "1.9.2",
"main": "dist/index.js",
"module": "dist/index.mjs",
"description": "A React hooks library for ink! contracts",
Expand Down Expand Up @@ -88,5 +88,8 @@
"default": "./dist/utils.js"
}
}
},
"dependencies": {
"nanoid": "3"
}
}
18 changes: 3 additions & 15 deletions packages/useink/src/utils/helpers/pseudoRandomId.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
export const pseudoRandomId = (t = 21) =>
crypto.getRandomValues(new Uint8Array(t)).reduce(
(t, e) =>
// rome-ignore lint: fancy code
(t +=
// rome-ignore lint: fancy code
(e &= 63) < 36
? e.toString(36)
: e < 62
? (e - 26).toString(36).toUpperCase()
: e > 62
? '-'
: '_'),
'',
);
import { nanoid } from 'nanoid';

export const pseudoRandomId = (t = 21) => nanoid(t);
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 5aa9d56

Please sign in to comment.