Skip to main content

3. Session Grants

A session grant authorises a terminal to perform card operations for a bounded time window. It carries the session key, permitted operations, and a backend signature the terminal uses to verify its authenticity.

Session grant structure and key derivation: Tech Specs §12.


GET /api/session-grant

Request a new session grant for the authenticated terminal.

Request headers: Authorization: Bearer <terminal-token>

Response (200 OK):

{
"keyVersion": 3,
"sessionKey": "<base64-encoded 32-byte key>",
"expiresAt": 1746700000,
"allowedOps": ["read", "debit", "checkin", "checkout"],
"signature": "<base64-encoded backend ECDSA/HMAC signature>"
}
FieldTypeDescription
keyVersionuint8Identifies the key set to use for per-card key derivation
sessionKeybase64 string32-byte terminal session key
expiresAtuint32UTC seconds; terminal must not use this grant after this time
allowedOpsstring[]Operations this terminal may perform during this session
signaturebase64 stringBackend signature over the above fields; terminal must verify before use

Allowed operations vocabulary:

ValuePermitted action
readRead and validate card state
debitDecrement card balance
checkinTransition card to CHECKED_IN
checkoutTransition card to CHECKED_OUT
topupIncrement card balance (Station only; requires online confirmation)
reissueInitialise or re-initialise a card (Station only)
blockSet card status to blocked (Station only)

Error responses:

CodeErrorCause
401 Unauthorizedinvalid_tokenBearer token missing or invalid
403 Forbiddenterminal_suspendedTerminal has been administratively disabled
429 Too Many Requestsrate_limitedToo many grant requests; retry after Retry-After seconds

Grant storage rules

  • The terminal must not persist the sessionKey to disk or durable storage.
  • The grant is held in process memory only for the duration of the session window.
  • If the terminal restarts, it must request a new grant before resuming card operations.