-- BioLock sign-in: each device's own fingerprint or face reader. No passwords and no outside sign-in providers. -- oauth_accounts is kept as it is, so data keyed to older accounts (such as verified repo owners) stays linked. CREATE TABLE biolock_credentials ( id TEXT PRIMARY KEY, -- credential id (base64url) user_id TEXT NOT NULL REFERENCES users(id), alg INTEGER NOT NULL, public_jwk TEXT NOT NULL, -- public key as JSON; the private key never leaves the device counter INTEGER NOT NULL DEFAULT 0, name TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL, last_used_at INTEGER ); CREATE INDEX biolock_credentials_user ON biolock_credentials (user_id); -- Single-use challenges, five minutes each. CREATE TABLE biolock_challenges ( id TEXT PRIMARY KEY, challenge TEXT NOT NULL, kind TEXT NOT NULL, -- signin | new | add | link user_id TEXT, -- for new: the id the account will get; for add and link: the account link_hash TEXT, expires_at INTEGER NOT NULL ); -- One-time links that add BioLock on another device. Only a SHA-256 hash of the link code is stored. CREATE TABLE biolock_links ( token_hash TEXT PRIMARY KEY, user_id TEXT NOT NULL REFERENCES users(id), expires_at INTEGER NOT NULL, created_at INTEGER NOT NULL );