CIBA (Client-Initiated Backchannel Authentication)
CIBA is BKey’s core mechanism. An agent or server requests approval for a specific action; the user’s phone gets a push notification and approves with facial biometrics. BKey returns an EdDSA-signed JWT that proves the consent.When to use it
- An agent needs explicit human approval before a sensitive action
- Per-transaction authorization (deploys, refunds, vault reads, DB writes)
- Anywhere you’d replace a soft “click Allow” dialog with cryptographic consent
One-line integration
Both SDKs expose a singleapprove() call that hides the full two-step protocol.
TypeScript
Python
approved: false (TypeScript).
Flow at the protocol level
If you need to talk to the API directly, CIBA is two calls:- Initiate —
POST /oauth/bc-authorizewith the user’s DID and the action scope. - Poll —
POST /oauth/tokenwithgrant_type=urn:openid:params:grant-type:cibauntil approved, denied, or expired.
Raw HTTP example
What the approval token contains
The token you receive is an EdDSA (Ed25519) JWT signed by BKey:| Claim | Meaning |
|---|---|
sub | DID of the user who approved |
scope | Scopes granted (must match what you requested) |
jti | Unique token ID — use for replay protection |
iss | BKey issuer URL |
iat / exp | Issued-at / expiry |
verifyToken() from @bkey/node (TypeScript) or the JWKS at GET /oauth/jwks.
Design rules
- One scope per sensitive action.
approve:deploy,approve:refund,approve:db:drop— not a single “admin” scope. Scopes show up on the user’s phone and in audit logs. - Always verify server-side.
approved: truemeans the flow completed.verifyToken()means the token is real. Don’t skip it. - Treat
jtias a nonce. Record approved JTIs server-side; reject replays. - Keep expiries tight. 300s (5 min) is the default and usually the right choice. Don’t use hours-long expiries — approvals are per-action, not per-session.
- Bind to details. Use
action_detailsto render amounts, recipients, and resources on the approval screen.
See also
- Encryption guide — EdDSA tokens, TLS transport, on-device key storage
- MCP integration — gating MCP tool calls on CIBA
@bkey/nodeon npm — token verification