fix: proper browser env check...
This commit is contained in:
@@ -78,9 +78,11 @@ export function bufToBn(buf: Buffer) {
|
||||
}
|
||||
|
||||
export function isomorphicRandomUUID() {
|
||||
if (self.crypto) {
|
||||
if (isBrowser() && self.crypto) {
|
||||
return self.crypto.randomUUID();
|
||||
} else {
|
||||
return randomUUID();
|
||||
}
|
||||
}
|
||||
|
||||
const isBrowser = new Function("try {return this===window;}catch(e){ return false;}");
|
||||
|
||||
Reference in New Issue
Block a user