|
| 1 | +# Specification: Transit Key Retrieval API |
| 2 | + |
| 3 | +## Overview |
| 4 | +Add a new API endpoint to the transit module to allow clients to retrieve metadata for individual transit keys. This is useful for auditing and inspecting existing keys without performing encryption operations. |
| 5 | + |
| 6 | +## Functional Requirements |
| 7 | +- **Endpoint:** `GET /api/v1/transit/keys/:name` |
| 8 | +- **Versioning:** Support retrieving metadata for a specific key version via a query parameter (e.g., `?version=2`). If omitted, return metadata for the latest version. |
| 9 | +- **Capability:** Require the `read` capability for the requested path. |
| 10 | +- **Response:** |
| 11 | + - `name`: String |
| 12 | + - `type`: String (e.g., aes256-gcm96, chacha20-poly1305) |
| 13 | + - `version`: Integer |
| 14 | + - `created_at`: RFC3339 Timestamp |
| 15 | + - `updated_at`: RFC3339 Timestamp |
| 16 | + |
| 17 | +## Non-Functional Requirements |
| 18 | +- **Security:** Ensure that the API never returns sensitive key material. |
| 19 | +- **Performance:** Retrieval should be highly efficient, leveraging database indexes. |
| 20 | + |
| 21 | +## Documentation Requirements |
| 22 | +- **Project Documentation:** Update `docs/engines/transit.md` to document the new key retrieval capability. |
| 23 | +- **API Reference:** Update `docs/openapi.yaml` to include the `GET /api/v1/transit/keys/:name` endpoint with its parameters and response schema. |
| 24 | + |
| 25 | +## Acceptance Criteria |
| 26 | +- [ ] Clients can retrieve metadata for a specific transit key by name. |
| 27 | +- [ ] The API correctly handles the `version` query parameter. |
| 28 | +- [ ] Requests without the `read` capability are rejected with `403 Forbidden`. |
| 29 | +- [ ] Requests for non-existent keys return `404 Not Found`. |
| 30 | +- [ ] API documentation (OpenAPI) is updated to include the new endpoint. |
| 31 | +- [ ] Transit engine documentation in `docs/engines/transit.md` is updated. |
| 32 | + |
| 33 | +## Out of Scope |
| 34 | +- CLI command implementation. |
| 35 | +- Bulk retrieval of all keys in a single request (listing is already a separate feature). |
| 36 | +- Modification of key properties via this endpoint. |
0 commit comments