| 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 BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, |
| 8 | account_id BIGINT 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 BYTEA NOT NULL, |
| 14 | token_hash TEXT NOT NULL UNIQUE, |
| 15 | created_ms BIGINT NOT NULL, |
| 16 | expires_ms BIGINT NOT NULL, |
| 17 | revoked_ms BIGINT, |
| 18 | last_used_ms BIGINT |
| 19 | ); |
| 20 | ON agent_grants(account_id); |