Skip to main content
Session keys are a SNIP-9 primitive: the user signs a delegation that authorises a server-held key to make specific calls (or any calls) on the user’s wallet for a limited time. After it expires or is revoked, that key is dead. Use cases:
  • Server-driven trades or payments without prompting the user every time
  • Background workers that act on the user’s behalf
  • Time-boxed automations (e.g. “rebalance once an hour for the next 24h”)
This page shows the full lifecycle (create → register → execute → revoke), with code lifted from staging-integration/staging-sessions.test.ts and staging-session-execute.test.ts.
Session keys are powerful — anything the session can do, your server can do without the user present. Always set the shortest reasonable validUntil, restrict allowedEntrypoints when you can, and revoke as soon as you’re done.

Initialise

1. Create a session key

Generates a fresh key pair locally and encrypts the private key. Nothing on-chain yet.

2. Register on-chain

The user’s wallet signs a transaction that authorises the session key. Chipi’s paymaster covers gas. Wait for confirmation before using the key — Starknet blocks settle in ~20-40s.

3. Execute a transaction with the session key

Once registered, your server can call any allowed entrypoint without the user’s PIN. Below: a self-transfer of 0.001 USDC.
You can pass multiple calls in the same executeTransactionWithSession invocation — they execute as a single multicall.

4. Revoke

When you’re done — or the user logs out — revoke immediately. The on-chain revocation makes the key unusable even if the encrypted private key leaks.
getSessionData reads the latest accepted block. Right after a register or revoke, the transaction can still be in a pre-confirmed block, and the read returns the previous state. Wait for the transaction first with waitForTransaction(txHash) from @chipi-stack/backend, which returns once the transaction is accepted on L2.

Putting it together

For production, prefer a webhook (configured at /configure/notifications) over polling — you can register the session key, return a 202 to your user, and trigger executeTransactionWithSession from the webhook handler when the register tx confirms.
✅ Verified against the live API on 2026-05-11.