LazorKit
Concepts

Session keys

Register a short-lived signer with spending actions in Protocol v1.

A session lets a separate Ed25519 key sign Execute until its absolute expiry slot. An Owner or Admin of that wallet creates or revokes the session.

Create a bounded session

import { Keypair } from '@solana/web3.js';
import { Actions, ed25519 } from '@lazorkit/sdk-legacy';

const sessionKey = Keypair.generate();
const expiresAt = BigInt(await connection.getSlot()) + 900n;
const grant = await client.createSession({
  payer: payer.publicKey,
  walletPda,
  adminSigner: ed25519(owner.publicKey),
  sessionKey: sessionKey.publicKey,
  expiresAt,
  actions: [Actions.solMaxPerTx(10_000_000n)],
});

Submit grant.instructions with the payer and Ed25519 Owner. With a passkey Owner, use prepareCreateSession and finalizeCreateSession. Store the session key in secure storage and keep the wallet PDA and expiry with it.

What a policy bounds

Actions can cap SOL or an individual mint over the session lifetime, per transaction, or per recurring slot window. Program allowlists and denylists restrict which programs the session can call. On the currently published Protocol deployment, a limit covers the asset it names. Give each asset you intend to bound a corresponding rule. A session without actions has no spending cap. Limits use lamports or the token's smallest unit.

Actions reference

Use Actions.solLimit, Actions.solMaxPerTx, Actions.solRecurringLimit, Actions.tokenLimit, Actions.tokenMaxPerTx, Actions.tokenRecurringLimit, Actions.programWhitelist and Actions.programBlacklist. Consult the installed SDK reference for argument names.

Revoke or close a session

Expiry stops the session from authorizing Execute. An Owner or Admin of the wallet can call revokeSession to close the PDA and choose the rent refund destination. The Protocol v1 instruction set does not include permissionless session cleanup.

For deferred execution, see passkey signing.