TypeScript SDK
Installation
@bkey/node:
Biometric approval in one line
This is the whole pattern — drop it anywhere you need a human in the loop.bkey.approve(...) call initiates CIBA, sends the push notification, and polls for the signed token. You never deal with the two-step protocol directly.
Verify the token before trusting it
The booleanapproved tells you the flow completed. verifyToken() tells you the token is real:
verifyToken is load-bearing and what it checks.
Anywhere a scope fits
| Use case | Scope | Example binding message |
|---|---|---|
| Deploy | approve:deploy | "Deploy api-gateway@abc123 to prod" |
| Refund | approve:payment | "Refund $29.99 to customer@example.com" |
| DB drop | approve:action | "Drop table users_archive (irreversible)" |
| Admin | approve:action | "Grant admin role to alice@corp" |
| Vault read | approve:action | "Read OPENAI_API_KEY" |
Structured action details
For anything the user should see in detail — amounts, recipients, resources — passactionDetails:
Checkout
For e-commerce checkouts, usecreateCheckoutRequest — it wraps CIBA with checkout-specific fields:
Vault
Request access to a stored secret (triggers biometric approval):x402 payments
See the x402 guide for the fullauthorizeX402Payment flow.
Examples
examples/typescript/agent-checkout— end-to-end checkout flowexamples/typescript/vault-access— vault secret retrieval with biometric approvalexamples/typescript/mcp-server— MCP tool gated on biometric approvalexamples/typescript/x402-agent— autonomous agent paying for x402 APIs