MCPcopy Create free account
hub / github.com/cloudflare/computer / randomId

Function randomId

packages/computer/src/assets/base32.ts:79–81  ·  view source on GitHub ↗
(randomBytes: (n: number) => Uint8Array = defaultRandomBytes)

Source from the content-addressed store, hash-verified

77// Generate a short random id: 16 random bytes (a UUID's worth of
78// entropy) Crockford base32-encoded into 26 lowercase characters.
79export function randomId(randomBytes: (n: number) => Uint8Array = defaultRandomBytes): string {
80 return encodeBase32(randomBytes(16));
81}
82
83function defaultRandomBytes(n: number): Uint8Array {
84 const bytes = new Uint8Array(n);

Callers 2

shareFunction · 0.85
base32.test.tsFile · 0.85

Calls 1

encodeBase32Function · 0.85

Tested by

no test coverage detected