| 1 | -- Agent grants (oxygenhub#241, keyless step 5): an account lets an agent |
| 2 | -- act for it. `grant` is the Oxygen grant its owner's key signed (spec |
| 3 | -- §14.7), which every certificate issued under it carries; the agent |
| 4 | -- holds only the token, which it exchanges for ten-minute certificates |
| 5 | -- and which signs nothing itself. Revoking stops the certificates. |
| 6 | ( |
| 7 | id INTEGER PRIMARY KEY, |
| 8 | account_id INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, |
| 9 | agent TEXT NOT NULL, |
| 10 | subject TEXT NOT NULL, |
| 11 | grantor TEXT NOT NULL, |
| 12 | scope TEXT NOT NULL, |
| 13 | signed BLOB NOT NULL, |
| 14 | token_hash TEXT NOT NULL UNIQUE, |
| 15 | created_ms INTEGER NOT NULL, |
| 16 | expires_ms INTEGER NOT NULL, |
| 17 | revoked_ms INTEGER, |
| 18 | last_used_ms INTEGER |
| 19 | ); |
| 20 | ON agent_grants(account_id); |