> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/sdk/api-references/react/usedecryptpublicvalues.md).

# useDecryptPublicValues

Mutation hook that decrypts publicly-decryptable FHE values using the network public key — no credential required.

Mutation hook that decrypts FHE encrypted values using the network public key. Unlike [`useDecryptValues`](/protocol/sdk/api-references/react/usedecryptvalues.md), this requires no permit or wallet signature — it only works for values the contract has marked publicly decryptable. On success the results are available via `data.clearValues` and written to the persistent decrypt cache.

## Import

```ts
import { useDecryptPublicValues } from "@zama-fhe/react-sdk";
```

## Usage

{% tabs %}
{% tab title="component.tsx" %}

```tsx
import { useDecryptPublicValues } from "@zama-fhe/react-sdk";

function RevealResult({ encryptedValues }: { encryptedValues: string[] }) {
  const { mutate: decryptPublicValues, data, isPending } = useDecryptPublicValues();

  return (
    <div>
      <button onClick={() => decryptPublicValues(encryptedValues)} disabled={isPending}>
        {isPending ? "Decrypting..." : "Reveal"}
      </button>
      {data && <output>{JSON.stringify(data.clearValues)}</output>}
    </div>
  );
}
```

{% endtab %}
{% endtabs %}

## Parameters

This hook takes no arguments.

***

## Mutation variables

The function passed to `mutate` / `mutateAsync` accepts:

### encryptedValues (first argument)

`EncryptedValue[]`

Array of encrypted values (hex strings) to decrypt with the network public key.

```ts
import { type EncryptedValue } from "@zama-fhe/sdk";
```

```ts
decryptPublicValues(["0xEncryptedValue1", "0xEncryptedValue2"]);
```

## Return Type

```ts
import { type DecryptPublicValuesResult } from "@zama-fhe/sdk";
```

The `data` property (after a successful mutation) is a `DecryptPublicValuesResult`:

| Field                   | Type                                 | Description                                                       |
| ----------------------- | ------------------------------------ | ----------------------------------------------------------------- |
| `clearValues`           | `Record<EncryptedValue, ClearValue>` | Decrypted clear-text values keyed by their encrypted value.       |
| `abiEncodedClearValues` | `Hex`                                | The clear values ABI-encoded, as passed to on-chain verification. |
| `decryptionProof`       | `Hex`                                | KMS signature proving the decryption is authentic.                |

```ts
// data.clearValues => { "0xEncryptedValue1": 500n, ... }
```

## Related

* [useDecryptValues](/protocol/sdk/api-references/react/usedecryptvalues.md) -- user decryption (requires a permit / wallet signature)
* [useDelegatedDecryptValues](/protocol/sdk/api-references/react/usedelegateddecryptvalues.md) -- decrypt using delegated user credentials
* [Encrypt & Decrypt guide](/protocol/sdk/guides/encrypt-decrypt.md) -- full walkthrough with end-to-end examples


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zama.org/protocol/sdk/api-references/react/usedecryptpublicvalues.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
