2021-08-06 15:13:51 +00:00
|
|
|
/// <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
|
2022-09-12 09:14:59 +00:00
|
|
|
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
2021-08-06 15:13:51 +00:00
|
|
|
*
|
2022-09-12 09:14:59 +00:00
|
|
|
* @throws {@link RangeError} if byteLength < 1
|
2021-08-06 15:13:51 +00:00
|
|
|
*
|
|
|
|
* @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()
|
2022-09-12 09:14:59 +00:00
|
|
|
* This is the synchronous version, consider using the asynchronous one for improved efficiency.
|
2021-08-06 15:13:51 +00:00
|
|
|
*
|
|
|
|
* @param byteLength - The desired number of random bytes
|
2022-09-12 09:14:59 +00:00
|
|
|
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
2021-08-06 15:13:51 +00:00
|
|
|
*
|
2022-09-12 09:14:59 +00:00
|
|
|
* @throws {@link RangeError} if byteLength < 1
|
2021-08-06 15:13:51 +00:00
|
|
|
*
|
|
|
|
* @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
|