cerberus-identity / tree / src/types.ts ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
/** Chamber 1 formats, the same as the Cerberus chamber interfaces kit version 1 (types.ts). */
export interface Verdict { ok: boolean; reason: string }

export interface Challenge {
  did: string;
  listingId: string;
  /** 16 random bytes as 32 lowercase hex characters, never reused */
  nonce: string;
  /** ISO 8601 UTC (toISOString) */
  issuedAt: string;
  /** 1 to 15 minutes after issuedAt */
  expiresAt: string;
  /** challengeMessage(this): the exact text the listing owner signs */
  message: string;
}

/** Remembers nonces that verified once. A Set works; a shared store (database, KV) can implement the same two calls. */
export interface NonceStore { has(nonce: string): boolean; add(nonce: string): unknown }

export interface IdentityOptions {
  /** challenge lifetime in milliseconds, 1 to 15 minutes; default 10 minutes */
  ttlMs?: number;
  /** nonce source, injected for deterministic tests; default 16 bytes from node:crypto */
  randomNonce?: () => string;
  /** replay guard; default a new in memory Set per chamber */
  seen?: NonceStore;
}

agentgate-source: code mirror on Cloudflare Pages. All repos