> 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/useregisterpermit.md).

# useRegisterPermit

Mutation hook that verifies and persists the signature an out-of-process signer produced for a prepared decryption permit.

Mutation hook that verifies and persists the signature an out-of-process signer produced for a [`usePreparePermit`](/protocol/sdk/api-references/react/usepreparepermit.md) payload — the second phase of the offline permit flow. No wallet account required: the permit is scoped by `prepared.signerAddress` and, for a delegated permit, the delegator address embedded in the signature-verified `eip712` — not a connected signer. Idempotent: registering the same `(prepared, signature)` pair more than once (e.g. a retried webhook delivery) replaces the stored entry instead of duplicating it. Automatically invalidates [`useHasPermit`](/protocol/sdk/api-references/react/usehaspermit.md) queries on success.

## Import

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

## Usage

```tsx
import { usePreparePermit, useRegisterPermit } from "@zama-fhe/react-sdk";

function CustodyPermitFlow({
  custodyAddress,
  tokenAddress,
}: {
  custodyAddress: `0x${string}`;
  tokenAddress: `0x${string}`;
}) {
  const { mutateAsync: preparePermit } = usePreparePermit();
  const { mutateAsync: registerPermit, isPending } = useRegisterPermit();

  const handleAuthorize = async () => {
    const prepared = await preparePermit({ signer: custodyAddress, contracts: [tokenAddress] });
    const signature = await custodyApi.signTypedData(prepared.eip712);
    await registerPermit({ prepared, signature });
  };

  return (
    <button onClick={handleAuthorize} disabled={isPending}>
      {isPending ? "Registering..." : "Complete offline authorization"}
    </button>
  );
}
```

## Parameters

`useRegisterPermit` takes no configuration parameters.

## Mutation variables

### params

`RegisterPermitParams`

| Field       | Type             | Meaning                                                     |
| ----------- | ---------------- | ----------------------------------------------------------- |
| `prepared`  | `PreparedPermit` | the payload `usePreparePermit` returned                     |
| `signature` | `Hex`            | the `eth_signTypedData_v4` signature over `prepared.eip712` |

```tsx
await registerPermit({ prepared, signature });
```

## Return Type

Returns a standard TanStack Query `UseMutationResult<void, Error, RegisterPermitParams>`.

**Throws:**

* `ConfigurationError` - `prepared` doesn't match the `PreparedPermit` shape (e.g. it crossed a process boundary and was corrupted)
* `PreparedPermitChainMismatchError` - the chain embedded in `prepared.eip712` doesn't match the currently active chain
* `PreparedPermitExpiredError` - the permit's validity window has already elapsed
* `TransportKeyPairChangedError` - no transport key pair is stored for `prepared.signerAddress`, or it no longer matches the public key `prepared.eip712` was built against; call `preparePermit` again
* `SigningFailedError` - the signature is invalid or malformed

## Related

* [`usePreparePermit`](/protocol/sdk/api-references/react/usepreparepermit.md) -- build the unsigned typed data this hook registers a signature for
* [`useBatchRegisterPermits`](/protocol/sdk/api-references/react/usebatchregisterpermits.md) -- the same, for a list of signed permits
* [`useGrantPermit`](/protocol/sdk/api-references/react/usegrantpermit.md) -- the atomic, wallet-connected counterpart
* [Offline signing guide](/protocol/sdk/guides/offline.md#offline-permits) -- the full offline permit workflow
* [ZamaSDK reference](/protocol/sdk/api-references/sdk/zamasdk.md#permits-registerpermit) -- `sdk.permits.registerPermit`'s full signature and typed errors


---

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