> ## 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.

# EList Attested Decrypt

> Decrypt or reveal an encrypted list handle

EList attested decrypt and reveal are the JS SDK counterparts to the on-chain `elist` type. An elist handle encodes an array of encrypted values — decrypting it returns all element values at once.

<Note>
  The length of an elist is always public and encoded in the handle itself. Only the element values are encrypted.
</Note>

## Prerequisites

The elist handle must be allowed to the caller's address before decryption can succeed. In your Solidity contract:

```solidity theme={null}
inco.allow(elist.unwrap(myList), msg.sender);
```

## Basic Decrypt

`eListAttestedDecrypt` requires a wallet client for signing. The result contains a `values` array with one plaintext entry per list element:

```javascript theme={null}
import { getViemChain, supportedChains, type HexString } from '@inco/lightning-js';
import { Lightning } from '@inco/lightning-js/lite';
import { createWalletClient, custom } from 'viem';

const walletClient = createWalletClient({
  chain: getViemChain(supportedChains.baseSepolia),
  transport: custom(window.ethereum!),
});

// for Base mainnet: Lightning.baseMainnet()
// recommended: pass your own RPC URLs (otherwise viem's public RPC is used)
const zap = await Lightning.baseSepoliaTestnet({
  hostChainRpcUrls: ['https://your-rpc-url'],
});
const result = await zap.eListAttestedDecrypt(
  walletClient,
  '0x<your_elist_handle>' as HexString,
);

const values = result.values; // array of plaintext elements
```

## Reencryption

The same reencryption options available for `attestedDecrypt` apply here. Pass an X-Wing keypair to receive the values encrypted to your local key:

```javascript theme={null}
import { generateXwingKeypair } from '@inco/lightning-js/lite';

const keypair = await generateXwingKeypair();

const result = await zap.eListAttestedDecrypt(
  walletClient,
  '0x<your_elist_handle>' as HexString,
  {
    reencryptPubKey: keypair.encodePublicKey(),
    reencryptKeypair: keypair,
  },
);

const values = result.values;
```

You can also pass only `reencryptPubKey` (without `reencryptKeypair`) to receive the encrypted attestation for forwarding to a delegate.

## Reveal (no wallet required)

If the elist has been publicly revealed on-chain via `e.reveal(myList)`, anyone can read its values without a wallet signature:

```javascript theme={null}
import { type HexString } from '@inco/lightning-js';

const result = await zap.eListAttestedReveal(
  '0x<your_revealed_elist_handle>' as HexString,
);

const values = result.values;
```

## Retry Configuration

Both methods accept an optional `backoffConfig`:

```javascript theme={null}
const result = await zap.eListAttestedDecrypt(
  walletClient,
  '0x<your_elist_handle>' as HexString,
  {
    backoffConfig: {
      maxRetries: 5,
      baseDelayInMs: 1000,
      backoffFactor: 2,
    },
  },
);
```
