Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

27 lines · 1.1 KBRaw History
1-- Open sign-up (SIGNUP=open): emailed one-time codes and the tickets that let a verified
2-- address create its account with a passkey. Only hashes are stored.
3
4-- One row per code request. An address that already has an account gets a row too (its code is
5-- never sent), so the daily limits count every sign-up email and wrong codes answer the same.
6CREATE TABLE signup_codes (
7 id TEXT PRIMARY KEY,
8 email TEXT NOT NULL, -- lower case
9 ip TEXT NOT NULL,
10 code_hash TEXT NOT NULL, -- HMAC of the 6-digit code
11 attempts INTEGER NOT NULL DEFAULT 0, -- codes entered, right or wrong
12 created_at TEXT NOT NULL,
13 expires_at TEXT NOT NULL,
14 used_at TEXT
15);
16CREATE INDEX signup_codes_email ON signup_codes(email, created_at);
17CREATE INDEX signup_codes_ip ON signup_codes(ip, created_at);
18
19-- A verified address may create its account (pick a username, create a passkey) once.
20CREATE TABLE signup_tickets (
21 id TEXT PRIMARY KEY,
22 token_hash TEXT NOT NULL UNIQUE, -- sha256 of the token in the browser's form
23 email TEXT NOT NULL,
24 created_at TEXT NOT NULL,
25 expires_at TEXT NOT NULL,
26 used_at TEXT
27);