26 lines
1.3 KiB
TypeScript
26 lines
1.3 KiB
TypeScript
/// <reference types="node" />
|
|
/**
|
|
* Secure random bytes for both node and browsers. Node version uses crypto.randomBytes() and browser one self.crypto.getRandomValues()
|
|
*
|
|
* @param byteLength - The desired number of random bytes
|
|
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
|
*
|
|
* @throws {RangeError}
|
|
* byteLength MUST be > 0
|
|
*
|
|
* @returns A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
|
*/
|
|
export declare function randBytes(byteLength: number, forceLength?: boolean): Promise<Uint8Array | Buffer>;
|
|
/**
|
|
* Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
|
*
|
|
* @param byteLength - The desired number of random bytes
|
|
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
|
*
|
|
* @throws {RangeError}
|
|
* byteLength MUST be > 0
|
|
*
|
|
* @returns A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
|
*/
|
|
export declare function randBytesSync(byteLength: number, forceLength?: boolean): Uint8Array | Buffer;
|
|
//# sourceMappingURL=randBytes.d.ts.map
|