Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -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();