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

# Rust client

Find the Rust client's API reference and the Rust method for each TypeScript SDK operation.

The crate reference on [docs.rs](https://docs.rs/zama_sdk) lists every public type, function, and method with its signature, including the Alloy signing and transaction adapters behind the `alloy` feature.

`Client::connect` creates a `Client`; `Client::sdk` returns an `SdkBuilder`; `SdkBuilder::build` creates an `Sdk`. Configuration uses `SdkConfig` and `ChainConfig`, with signer and storage configuration on the builder. `Sdk::close` releases the SDK context and its callback channels.

## Operations

Each daemon operation runs the matching TypeScript SDK method. The `Sdk` exposes encryption and account updates directly, and groups the other operations behind `decryption()`, `permits()`, `offline()`, and `delegations()`.

| TypeScript SDK                                                                                                                                | Rust                                              |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `new ZamaSDK(config)`                                                                                                                         | `client.sdk(config).build()`                      |
| [`sdk.terminate`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#terminate)                                                 | `sdk.close()`                                     |
| Signer [`walletAccount`](https://docs.zama.org/protocol/sdk/api-references/sdk/genericsigner.md#walletaccount) change                         | `sdk.update_account`                              |
| `sdk.encrypt`                                                                                                                                 | `sdk.encrypt`                                     |
| [`sdk.decryption.decryptValues`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#decryption-decryptvalues)                   | `sdk.decryption().decrypt_values`                 |
| `sdk.decryption.decryptPublicValues`                                                                                                          | `sdk.decryption().decrypt_public_values`          |
| `sdk.decryption.delegatedDecryptValues`                                                                                                       | `sdk.decryption().delegated_decrypt_values`       |
| `sdk.decryption.delegatedBatchDecryptValues`                                                                                                  | `sdk.decryption().delegated_batch_decrypt_values` |
| [`sdk.permits.grantPermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-grantpermit)                             | `sdk.permits().grant_permit`                      |
| [`sdk.permits.hasPermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-haspermit)                                 | `sdk.permits().has_permit`                        |
| [`sdk.permits.grantDelegationPermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-grantdelegationpermit)         | `sdk.permits().grant_delegation_permit`           |
| [`sdk.permits.hasDelegationPermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-hasdelegationpermit)             | `sdk.permits().has_delegation_permit`             |
| [`sdk.permits.registerPermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-registerpermit)                       | `sdk.permits().register_permit`                   |
| [`sdk.permits.revokePermits`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-revokepermits)                         | `sdk.permits().revoke_permits`                    |
| [`sdk.permits.clear`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-clear)                                         | `sdk.permits().clear`                             |
| [`sdk.permits.warmTransportKeyPair`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-warmtransportkeypair)           | `sdk.permits().warm_transport_key_pair`           |
| [`sdk.permits.warmTransportKeyPairScope`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-warmtransportkeypairscope) | `sdk.permits().warm_transport_key_pair_scope`     |
| [`sdk.permits.revokeTransportKeyPair`](https://docs.zama.org/protocol/sdk/api-references/sdk/zamasdk.md#permits-revoketransportkeypair)       | `sdk.permits().revoke_transport_key_pair`         |
| [`sdk.offline.prepare`](https://docs.zama.org/protocol/sdk/api-references/sdk/offline.md#prepare)                                             | `sdk.offline().prepare`                           |
| [`sdk.offline.preparePermit`](https://docs.zama.org/protocol/sdk/api-references/sdk/offline.md#preparepermit)                                 | `sdk.offline().prepare_permit`                    |
| [`sdk.delegations.delegateDecryption`](https://docs.zama.org/protocol/sdk/api-references/sdk/delegation.md#delegatedecryption)                | `sdk.delegations().delegate_decryption`           |
| [`sdk.delegations.revokeDelegation`](https://docs.zama.org/protocol/sdk/api-references/sdk/delegation.md#revokedelegation)                    | `sdk.delegations().revoke_delegation`             |
| [`sdk.delegations.isActive`](https://docs.zama.org/protocol/sdk/api-references/sdk/delegation.md#isactive)                                    | `sdk.delegations().is_active`                     |
| [`sdk.delegations.getExpiry`](https://docs.zama.org/protocol/sdk/api-references/sdk/delegation.md#getexpiry)                                  | `sdk.delegations().get_expiry`                    |
| [`sdk.delegations.getStatus`](https://docs.zama.org/protocol/sdk/api-references/sdk/delegation.md#getstatus)                                  | `sdk.delegations().get_status`                    |

`revoke_permits(None)` revokes every permit for the current signer; an empty slice revokes nothing. `Client::sdk_version` returns the daemon's bundled SDK version.

`batchPreparePermits`, `batchRegisterPermits`, and the `Token` and `WrappedToken` APIs have no Rust equivalent yet.

## Callback channels

These have no TypeScript equivalent. They connect your application's wallet, storage, and event handlers to the daemon:

* `SdkBuilder::signer`, `SdkBuilder::storage`, and `SdkBuilder::events` attach them when you build the `Sdk`.
* `Sdk::wait_channel_closed` reports when a channel closes.

The Rust client does not reattach a closed channel. See [Recover from disconnections](https://docs.zama.org/protocol/sdk/go-and-rust-guide/guides/recover-from-disconnections.md) for how to rebuild the SDK context.


---

# 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/rust-client.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.
