release: WRNexusJS 0.4.0
This commit is contained in:
@@ -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