/** * seed * * Seeds PRNG with supplied random values if these values have enough entropy. * * A false return value means the RNG is currently insecure; however a true * return value does not mean it is necessarily secure (depending on how you * collected the seed) though asmCrypto will be forced to assume this. * * The input buffer will be zeroed to discourage reuse. You should not copy it * or use it anywhere else before passing it into this function. * * **DISCLAIMER!** Seeding with a poor values is an easiest way shoot your legs, so * do not seed until you're know what entropy is and how to obtail high-quality random values, * **DO NOT SEED WITH CONSTANT VALUE! YOU'LL GET NO RANDOMNESS FROM CONSTANT!** */ export function Random_seed(seed: any): boolean; /** * getValues * * Populates the buffer with cryptographically secure random values. These are calculated using `crypto.getRandomValues` if it is available, as well as our own ISAAC PRNG implementation. * * If `crypto.getRandomValues` is not available (e.g. older browsers such as IE10 [1]), then the ISAAC PRNG *must* be seeded manually with `Random_seed`, except if param `allowWeakRandomness` is set to true. * * *We assume the system RNG is strong*; therefore param `allowUseSystemRNG` is true by default. But if your use case need stronger RNG, then you should manually seeds the RNG by using `Random_seed` before using `Random_getValues`. This is advisable for very important situations, such as generation of long-term secrets. See also [2]. * * [1] https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues * [2] https://en.wikipedia.org/wiki/Dual_EC_DRBG * * In all cases, we opportunistically seed using various arbitrary sources such as high-resolution time and one single value from the insecure Math.random(); however this is not reliable as a strong security measure. */ export function Random_getValues(buffer: any, allowUseSystemRNG?: boolean, allowWeakRandomness?: boolean): any; /** * getNumber * * A drop-in `Math.random` replacement. * Intended for prevention of random material leakage out of the user's host. */ export function Random_getNumber(): number;