Skip to content

Commit

Permalink
Use crypto to generate token
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu-w committed Mar 3, 2025
1 parent 0f2336c commit 287345e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// import Bowser from 'bowser';
import loglevel from "loglevel";

/**
* returns true if the given object is a promise
*/
Expand Down Expand Up @@ -31,7 +30,7 @@ export function randomInt(min: number, max: number): number {
* https://stackoverflow.com/a/8084248
*/
export function randomToken(): string {
return Math.random().toString(36).substring(2);
return crypto.getRandomValues(new Uint8Array(16)).toString();
}

let lastMs = 0;
Expand Down

0 comments on commit 287345e

Please sign in to comment.