MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / generateCode

Function generateCode

apps/host-selfhost/src/auth/invites.ts:40–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39// 12 chars grouped as XXXX-XXXX-XXXX — easy to read aloud or paste.
40const generateCode = (): string => {
41 const bytes = randomBytes(12);
42 const chars = Array.from(bytes, (b) => ALPHABET[b % ALPHABET.length]);
43 return [chars.slice(0, 4), chars.slice(4, 8), chars.slice(8, 12)]
44 .map((g) => g.join(""))
45 .join("-");
46};
47
48const toRow = (raw: Row): InviteCodeRow => ({
49 id: String(raw.id),

Callers 1

createInviteCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected