| 1 | -- team-members.md §4: adding someone by email. The directory never sees the |
| 2 | -- address. An owner's add intent is stored here (the intent id hashed, the |
| 3 | -- optional name sealed), the credential origin resolves the address and |
| 4 | -- signs a receipt naming the person ref, and the verified ref is sealed into |
| 5 | -- the same row until the owner confirms. One live intent per owner; rows |
| 6 | -- expire after ten minutes and are deleted. |
| 7 | CREATE TABLE team_add_intents ( |
| 8 | intent_hash BLOB PRIMARY KEY CHECK(typeof(intent_hash) = 'blob' AND length(intent_hash) = 32), |
| 9 | team_id INTEGER NOT NULL REFERENCES teams(id) ON DELETE RESTRICT, |
| 10 | requester TEXT NOT NULL UNIQUE CHECK(length(requester) = 29 AND substr(requester,1,3) = 'pr_' AND substr(requester,4) NOT GLOB '*[^a-z2-7]*'), |
| 11 | role TEXT NOT NULL CHECK(role IN ('owner', 'member')), |
| 12 | sealed_name BLOB CHECK(sealed_name IS NULL OR (typeof(sealed_name) = 'blob' AND length(sealed_name) BETWEEN 29 AND 92)), |
| 13 | sealed_person BLOB CHECK(sealed_person IS NULL OR (typeof(sealed_person) = 'blob' AND length(sealed_person) BETWEEN 29 AND 92)), |
| 14 | expires_at INTEGER NOT NULL CHECK(typeof(expires_at) = 'integer' AND expires_at > 0) |
| 15 | ); |
| 16 | -- Single use for member-resolution receipts: the hash of each accepted jti, |
| 17 | -- kept until the receipt itself would have expired. |
| 18 | CREATE TABLE team_resolve_receipts ( |
| 19 | jti_hash BLOB PRIMARY KEY CHECK(typeof(jti_hash) = 'blob' AND length(jti_hash) = 32), |
| 20 | expires_at INTEGER NOT NULL CHECK(typeof(expires_at) = 'integer' AND expires_at > 0) |
| 21 | ); |
| 22 | |