-
Notifications
You must be signed in to change notification settings - Fork 0
/
webcrypto-random-int.d.ts
58 lines (58 loc) · 1.52 KB
/
webcrypto-random-int.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Int returns a uniform random value in [0,max], excluding max itself.
*
* It throw error if (!canIUse || !Number.isInteger(max) || max <= 0 || max-1 > 0xffffffff) .
*
* @param {number} max
* @returns {number}
*/
export function numInt(max: number): number;
/**
* bigInt returns a uniform random value in [0,max], excluding max itself.
*
* It throw error if (!canIUse || typeof max !== "bigint" || max <= 0).
*
* @param {bigint} max
* @returns {bigint}
*/
export function bigInt(max: bigint): bigint;
/**
* ```
* str(32, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
* ```
*
* It throw error if (typeof letters !== "string" || !Number.isInteger(length) || !canIUse).
*
* @param {number} length
* @param {string} letters
* @returns {string}
*/
export function str(length: number, letters: string): string;
export const canIUse: boolean;
export namespace notRandomTools {
/**
* Bytes to bigint, not ramdom.
*
* It throw error if (!(bytes instanceof Uint8Array)).
*
* @param {Uint8Array} bytes
* @returns {bigint}
*/
function uint8ArrayToBigint(bytes: Uint8Array): bigint;
/**
* Get bigint bitLength, not random.
*
* @param {bigint} n
* @returns {number}
*/
function bigintGetBitlen(n: bigint): number;
}
declare namespace _default {
export { canIUse };
export { notRandomTools };
export { numInt };
export { bigInt };
export { str };
}
export default _default;
//# sourceMappingURL=webcrypto-random-int.d.ts.map