Initial Commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Default RNG factory for bitpacker-network.
|
||||
*
|
||||
* Wraps `cryptoRng()` from `@suaveplan/random` so callers don't have to
|
||||
* reach into another package for the standard CSPRNG-backed source. The
|
||||
* `cryptoRng()` factory throws `RANDOM.SOURCE.UNAVAILABLE` if the host
|
||||
* environment lacks `globalThis.crypto.getRandomValues`; we surface that
|
||||
* directly so consumers know to inject a seeded `Rng` in environments
|
||||
* without a CSPRNG (or in tests that need deterministic replay).
|
||||
*/
|
||||
import { cryptoRng } from "@suaveplan/random";
|
||||
import type { Rng } from "@suaveplan/types";
|
||||
|
||||
export const defaultRng = (): Rng => cryptoRng();
|
||||
Reference in New Issue
Block a user