Package reference
API reference
The reference implementation is split into small packages. Package names are local workspace packages today and intended public package names later.
Packages
| Package | Purpose |
@x429/core | Ticket creation, encoding, signing, verification, capacity helpers, nonce store. |
@x429/hono | Workers/Hono-style middleware and discovery handler. |
@x429/client | x429-aware fetch wrapper and state machine. |
@x429/payment-mock | Mock payer and verifier for priority demos. |
@x429/payment-x402 | Placeholder for real x402 settlement integration. |
Core exports
| Export | Purpose |
generateKeyPair() | Create Ed25519 public/private keys. |
createTicket() | Create and sign a ticket. |
verifyTicket() | Verify signature, scope, binding, window, and optionally spend nonce. |
encodeTicket() | Convert ticket JSON into base64url for X429-Ticket. |
decodeTicket() | Parse an encoded ticket header. |
createX429Response() | Build a compatible 429 response body and headers. |
createWellKnown() | Build discovery JSON. |
InMemoryNonceStore | Local/test nonce store. |
Ticket fields
| Field | Meaning | Required |
id | Unique ticket id. | yes |
kid | Issuer key id. | yes |
issuer | Origin that issued the ticket. | yes |
scope | Resource this ticket can redeem against. | yes |
bind | Pseudonymous binding object. | yes |
notBefore | Earliest free redemption time. | yes |
notAfter | Latest redemption time. | yes |
nonce | Single-use replay guard. | yes |
sig | Ed25519 signature. | yes |
Client options
| Option | Purpose |
deadlineMs | Maximum useful wait. |
maxSpend | Budget cap for paid priority. |
payment | Payer adapter. |
clientKey | Public key used for ticket binding. |
publicKeyResolver | Optional override for issuer key lookup. |
onEvent | Observability callback. |