feat(tokens): implement path-scoped relayfile tokens
Merged
KH
6mo ago+479+479+012345678901234567890123456789-56-56-01234567890123456789
Summary
- replace the
/v1/tokens/path501 stub with realrelay_pa_*path token pair issuance - accept workspace tokens through
x-api-keyand the cloud-compatibleAuthorization: Bearer relay_ws_*form - normalize relayfile path globs, enforce requested path scopes against the workspace token grant, and preserve path-token refresh lineage
- update SDK/types/tests/docs for the real path token response
Self-review
- Checked that normal bearer JWT auth remains unchanged: only
Bearer relay_ws_*is treated as API-key-backed workspace-token auth. - Checked that derived path tokens keep
workspaceTokenIdmetadata, so existing workspace-token revocation checks still close the lineage. - Checked that
/foo/**normalizes to/foo/*, and arbitrary scopes outside the requested path set are rejected before issuance.
Verification
npm --workspace @relayauth/server exec -- node --test --import tsx src/__tests__/tokens-route.test.tsnpm --workspace @relayauth/sdk exec -- node --test --import tsx src/__tests__/client-tokens.test.tsnpm --workspace @relayauth/server run typechecknpm --workspace @relayauth/sdk run typechecknpm --workspace @relayauth/types run typecheckgit diff --check
Closes #40