| 1 | -- Device sign-in (oxygenhub#67, RFC 8628 in shape): an app holds the |
| 2 | -- device code (stored as its hash) and polls; the user approves the user |
| 3 | -- code on the web, choosing the scopes; the token is made when the app |
| 4 | -- next polls, so no token is stored in the clear. |
| 5 | ( |
| 6 | id INTEGER PRIMARY KEY, |
| 7 | device_hash TEXT NOT NULL UNIQUE, |
| 8 | user_code TEXT NOT NULL UNIQUE, |
| 9 | client TEXT NOT NULL, |
| 10 | scopes TEXT NOT NULL, |
| 11 | created_ms INTEGER NOT NULL, |
| 12 | expires_ms INTEGER NOT NULL, |
| 13 | last_poll_ms INTEGER NOT NULL DEFAULT 0, |
| 14 | account_id INTEGER REFERENCES accounts(id) ON DELETE CASCADE, |
| 15 | approved_scopes TEXT NOT NULL DEFAULT '', |
| 16 | denied INTEGER NOT NULL DEFAULT 0 |
| 17 | ); |