-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sdk-client-v3): remove crypto module from SDK
- remove crypto module reference from SDK - fix type errors and return type values
- Loading branch information
Showing
7 changed files
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
export default function generateID() { | ||
// @ts-ignore | ||
const str = ([1e6] + -1e3 + -4e3 + -8e3 + -1e11).replace( | ||
/[018]/g, | ||
(c: number) => | ||
( | ||
c ^ | ||
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) | ||
).toString(16) | ||
return ([1e6] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c: string) => | ||
( | ||
parseInt(c) ^ | ||
(Math.floor(Math.random() * 256) & (15 >> (parseInt(c) / 4))) | ||
).toString(16) | ||
) | ||
|
||
return 'abcdef'[Math.floor(Math.random() * 'abcdef'.length)] + '' + str | ||
} |