Issue a Token and authenticate with it #80

Open
opened 2026-11-27 16:43:21 -05:00 by bobby · 0 comments
Owner

Part of #73 (spec: #72)

What to build

The Owner issues a Token with hapi token issue <principal>, which prints hapi_<public-id>_<secret> once. A Person uses it as a bearer Token and lists their own Tokens with GET /v1/tokens. Secrets (256-bit) are stored only as SHA-256 and looked up on every request. Every Token failure gets the same 401.

Acceptance criteria

  • hapi token issue prints the Token once and stores only its hash
  • GET /v1/tokens with a valid Token lists only the caller's Tokens (id, public id, created, expires, last used; never secrets or hashes), paginated
  • Missing, malformed, unknown, and wrong-secret Tokens all get a byte-identical 401 problem with WWW-Authenticate: Bearer
  • Credentials record kind = api_token
Part of #73 (spec: #72) ## What to build The Owner issues a Token with `hapi token issue <principal>`, which prints `hapi_<public-id>_<secret>` once. A Person uses it as a bearer Token and lists their own Tokens with `GET /v1/tokens`. Secrets (256-bit) are stored only as SHA-256 and looked up on every request. Every Token failure gets the same `401`. ## Acceptance criteria - [ ] `hapi token issue` prints the Token once and stores only its hash - [ ] `GET /v1/tokens` with a valid Token lists only the caller's Tokens (id, public id, created, expires, last used; never secrets or hashes), paginated - [ ] Missing, malformed, unknown, and wrong-secret Tokens all get a byte-identical `401` problem with `WWW-Authenticate: Bearer` - [ ] Credentials record `kind = api_token`
bobby added the ready-for-agent label 2026-11-27 16:43:21 -05:00
bobby added a new dependency 2026-11-27 16:43:21 -05:00
bobby added a new dependency 2026-11-27 16:43:21 -05:00
bobby added a new dependency 2026-11-27 16:43:22 -05:00
bobby added a new dependency 2026-11-27 16:43:22 -05:00
bobby added a new dependency 2026-11-27 16:43:22 -05:00
bobby added a new dependency 2026-11-27 16:43:24 -05:00
bobby added a new dependency 2026-11-27 16:43:30 -05:00
bobby added a new dependency 2026-11-27 16:44:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: bobby/hapi#80