Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/sdk-guides/public-decryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const handles = [
const values = instance.publicDecrypt(handles);
```

{% hint style="info" %}
The total bit length of all ciphertexts being decrypted in a single request must not exceed 2048 bits. Each encrypted type has a specific bit length, for instance `euint8` uses 8 bits and `euint16` uses 16 bits. For the full list of encrypted types and their corresponding bit lengths, refer to the [encrypted types documentation](../solidity-guides/types.md#list-of-encrypted-types).
Copy link
Copy Markdown
Member

@jatZama jatZama Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a warning: there is an exception for ebool taking 2 bits instead of the expected 1 bit, due to a tfhe-rs quirk. I don't know exactly this is the case, we should ask tfhe-rs team.

{% endhint %}

## Onchain Public Decrypt

For more details please refer to the on [onchain Oracle public decryption page](https://docs.zama.ai/protocol/solidity-guides/smart-contract/oracle).
10 changes: 9 additions & 1 deletion docs/sdk-guides/user-decryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ For more details on the topic please refer to [the ACL documentation](../solidit

## Step 2: decrypt the ciphertext

Using that ciphertext handle user decryption is performed client-side using the `@zama-fhe/relayer-sdk` library.
Using those ciphertext handles, user decryption is performed client-side using the `@zama-fhe/relayer-sdk` library.
The `userDecrypt` function takes a **list of handles**, allowing you to decrypt multiple ciphertexts in a single request. In this example, provide just one handle.
The user needs to have created an instance object prior to that (for more context see [the relayer-sdk setup page](./initialization.md)).

```ts
Expand All @@ -58,6 +59,8 @@ The user needs to have created an instance object prior to that (for more contex
// contractAddress: [`string`]

const keypair = instance.generateKeypair();
// userDecrypt can take a batch of handles (with their corresponding contract addresses).
// In this example we only pass one handle.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a specific example with at least 2 handles at once.

const handleContractPairs = [
{
handle: ciphertextHandle,
Expand Down Expand Up @@ -89,5 +92,10 @@ const result = await instance.userDecrypt(
durationDays,
);

// result maps each handle to its decrypted value
const decryptedValue = result[ciphertextHandle];
```

{% hint style="info" %}
The total bit length of all ciphertexts being decrypted in a single request must not exceed 2048 bits. Each encrypted type has a specific bit length, for instance `euint8` uses 8 bits and `euint16` uses 16 bits. For the full list of encrypted types and their corresponding bit lengths, refer to the [encrypted types documentation](../solidity-guides/types.md#list-of-encrypted-types).
{% endhint %}