Endpoints for a TOKEN_ENCRYPTION_KEY rotation. Rotating the encryption key describes the whole procedure.
Rotation status
Section titled “Rotation status”GET /admin/encryption/rotationRequires settings:manage, or the platform principal. Counts how many stored values each store holds that only TOKEN_ENCRYPTION_KEY_PREVIOUS opens, that are still plaintext, or that neither key opens. Every call reads the stored values again, so previous_key_can_go is never true while a value still needs the previous key.
curl -s http://127.0.0.1:3000/admin/encryption/rotation \ -H "Authorization: Bearer $TOKEN"
Response: 200 OK. This one is from part way through a re-seal, with stores cut to three of its fourteen entries:
{ "key_configured": true, "previous_key_configured": true, "previous_key_can_go": false, "remaining": 3, "unsealed": 0, "unreadable": 0, "stores": [ { "store": "oauth_client_keys", "previous": 1, "unsealed": 0, "unreadable": 0 }, { "store": "attestation_key", "previous": 1, "unsealed": 0, "unreadable": 0 }, { "store": "delegation_key", "previous": 1, "unsealed": 0, "unreadable": 0 } ], "job": { "id": "ffd3922d-db8d-4fd9-a287-be128500c3be", "status": "running", "progress": null }}| Field | Type | Description |
|---|---|---|
key_configured | boolean | Whether TOKEN_ is set |
previous_ | boolean | Whether TOKEN_ is set to a key other than TOKEN_ |
previous_ | boolean | Safe to unset TOKEN_: it’s configured, and remaining is 0. Always false when it isn’t configured |
remaining | integer | Values only the previous key opens |
unsealed | integer | Plaintext values, written while the instance ran without a key. The next boot’s re-seal encrypts them |
unreadable | integer | Values neither key opens. They can’t be re-sealed |
stores | array | previous, unsealed and unreadable for each store. See below |
job | object or null | The happyview. job that is pending, running, pausing or paused, as id, status and progress. progress is null until the job has finished its pass. null when there’s no such job |
The stores are dpop_keys, dpop_sessions, oauth_client_keys, external_account_tokens, service_identity, verification_methods, space_dids, attestation_key, delegation_key, script_variables, oauth_sessions, linked_repo_sessions, oauth_state and plugin_secrets.
When TOKEN_ENCRYPTION_KEY isn’t set, the response has no unsealed or unreadable:
{ "key_configured": false, "previous_key_configured": false, "previous_key_can_go": false, "remaining": 0, "stores": [], "job": null}Start a re-seal
Section titled “Start a re-seal”POST /admin/encryption/rotationRequires settings:manage. If a happyview.reseal job is pending, running, pausing or paused, the response names that job and no new one is created; otherwise a new job is queued. Boot already queues one when anything needs re-sealing, so call this only when that job ended before finishing.
curl -s -X POST http://127.0.0.1:3000/admin/encryption/rotation \ -H "Authorization: Bearer $TOKEN"
Response: 202 Accepted
{ "job_id": "ffd3922d-db8d-4fd9-a287-be128500c3be" }With no TOKEN_ENCRYPTION_KEY there’s nothing to re-seal with, and the answer is 400. The platform principal can read the status but not start a job, so it gets 403.
© HappyProto

