> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inco.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Decryption & sessions

> Reveal through scoped sessions in both Node and browsers.

## Reveal handles

| Method | Input | Result |
| - | - | - |
| `decrypt` | `{ handle: Hex, decimals?: number, token?: Address }` | `Promise<number>`; decimals defaults to 18. Here `token` is the cToken address. |
| `decryptHandles` | `{ handles: Hex[], tokens?: Address[] }` | `Promise<bigint[]>`; raw values in input order. Here `tokens` are cToken addresses for scope resolution. |
| `setSession` | `Session` or null | Synchronous boolean: true when adopted, false when unusable or cleared. |

```ts theme={null}
const rows = await ctoken.preflightHandles({ tokens: [USDC] });
const row = rows[0];
if (row.error) throw row.error;
if (row.handle && row.cToken) {
  const [raw] = await ctoken.decryptHandles({
    handles: [row.handle],
    tokens: [row.cToken],
  });
  console.log(raw);
}
```

Pass the cToken addresses for authorization scope. Results follow handle order.

Zero handles resolve locally to zero; duplicates decrypt once. Malformed handles fail locally.

`decryptHandles` rejects if any handle remains pending; `balancesSettled` exposes pending rows. A declined signature ends the operation.

## Session lifecycle

The first reveal may request a temporary session signature, reused for subsequent reveals. Sessions bind to owner, chain, and verifier; default expiry is four hours.

```ts theme={null}
// Adopt a session created by a compatible host integration.
const adopted = ctoken.setSession(hostSession);

// Clear the session and invalidate outstanding grants.
ctoken.setSession(null);
```

`Session` contains `account` (temporary signer), `voucher`, `expiresAt` (Unix milliseconds), and `dialect` (`generic` or `ctoken`). Adoption checks expiry, dialect, and owner. Normal use creates the session internally.

Node and browsers share this flow. A Node signer may still require user interaction.

To change accounts or transports, construct a new client.

## Scoped authorization and smart accounts

The default verifier restricts requests to its factory’s cTokens. The SDK encodes the underlying token scope; an empty voucher allowlist permits future holdings. Custom verifiers may apply different policies.

Sessions authorize confidential reads and attestations. Transactions still need the wallet. Keep session signers in memory and clear them on disconnect.

Smart accounts use the same session flow and must produce signatures accepted by their ERC-1271 contract. For direct Lightning integration, see [raw requests](https://docs.inco.org/ctoken/raw.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.