Skip to content

D1 Schema

The cube-ledger D1 database is shared between the gate worker and ledger worker.

Token records. Primary key: token_hash.

Section metadata. Maps section keys to display names and descriptions.

Person records. Links token holders to identities for TOTP enrollment.

TOTP state: secret, verified status, recovery codes.

Active TOTP sessions (24h TTL). Keyed by session ID stored in cc_sid cookie.

Security escalation markers. Time-limited TOTP enforcement.

User feedback submissions. Indexed by page and creation time.

Audit log of section access attempts. Non-blocking write via ctx.waitUntil.

Aggregated daily metrics. Populated by nightly cron job.