release: WRNexusJS 0.4.0
This commit is contained in:
1 parent
8b728a3e5d
commit
30e5721e84
250 files changed
+10065
-3923
No files matched your search
@@ -1,7 +1,8 @@
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
export function defaultRandomBytes(length: number): Uint8Array {
|
||||
if (!Number.isInteger(length) || length < 1) throw new RangeError("random byte length must be positive");
|
||||
if (!Number.isInteger(length) || length < 1)
|
||||
throw new RangeError("random byte length must be positive");
|
||||
const bytes = new Uint8Array(length);
|
||||
crypto.getRandomValues(bytes);
|
||||
return bytes;
|
||||
|
||||
Reference in new issue
Block a user