Skip to main content
PIN is weak — not recommended for production.A user-typed PIN is a short, low-entropy string. Anyone who shoulder-surfs the PIN, observes a phishing form, or compromises the browser at typing time can decrypt the wallet’s private key. PIN remains in the SDK only as a fallback recovery surface for users who lose access to their platform authenticator.Production embedded-wallet apps should default to a platform passkey (Touch ID, Face ID, Windows Hello, Android biometrics) via the @chipi-stack/chipi-passkey package. For SHHH V8.4 wallets, signerKind: "WEBAUTHN_P256" keeps the private key inside the platform authenticator — it never leaves the device, never reaches Chipi servers, and is never derived from a user-typed secret.Only prompt for a PIN as the encryption key when:
  • The user explicitly opted into a PIN-only flow (e.g. cold-storage / paper-backup recovery), or
  • The platform genuinely has no WebAuthn / biometric support available.
If you are migrating an existing PIN-based wallet to a passkey, look up useMigrateWalletToPasskey in your framework’s hook docs.
Session keys enable temporary, delegated transaction execution for CHIPI wallets and SHHH V8.4 wallets, which embed the same sessions component. This page documents all available session methods.

sessions.createSessionKey()

Generate a session keypair locally. The SDK returns the data but does NOT store it.

Usage

Parameters

Return Value

Returns a SessionKeyData object:

Example

Store session data only in client-side secure storage (localStorage, Secure Enclave, Keychain). Never in your backend database.

sessions.addSessionKeyToContract()

Register a session key on the CHIPI wallet smart contract. Requires owner signature.

Usage

Parameters

Return Value

Returns a Promise<string> with the transaction hash.

Example

This uses gasless transactions via the Chipi paymaster. Users don’t need STRK for gas.

sessions.setupSession() (14.14.0+)

Register a session and its spending policies in one owner-signed transaction. Equivalent to addSessionKeyToContract followed by one setSpendingPolicy per token, but the owner signs once and the session never exists on-chain without its caps.

Usage

Parameters

Every call is built and validated before anything is signed: an invalid policy throws INVALID_SPENDING_POLICY and nothing is sent. maxPerWindow: 0n means no window cap.

Call builders

The same calls are exported as pure functions, for batching with other calls or signing with your own owner path: All are imported from @chipi-stack/backend, together with normalizeEntrypoints and validateSpendingPolicyConfig.

executeTransactionWithSession()

Execute a transaction using a session key instead of the owner’s private key.

Usage

Parameters

Return Value

Returns a Promise<string> with the transaction hash.

Example

Signature Format: Session transactions use a 4-element signature [sessionPubKey, r, s, validUntil] instead of the owner’s 2-element [r, s]. The SDK handles this automatically.

sessions.revokeSessionKey()

Remove a session key’s authorization from the CHIPI wallet contract.

Usage

Parameters

Return Value

Returns a Promise<string> with the transaction hash.

Example

Always revoke sessions on logout to prevent unauthorized access.

sessions.getSessionData()

Query the on-chain status of a session key.

Usage

Parameters

Return Value

Returns a Promise<SessionDataResponse>:

Example

Use getSessionData() to check remaining calls before batch operations.

Error Handling

All session methods throw ChipiSessionError for session-specific failures:

Error Codes