> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ana.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Security

> The trust model of Anafi: who holds what, what each party can do, what happens in each failure case, and what you can verify yourself.

After you read this page, you can explain to a user who can move funds, what Anafi can and cannot do, what happens when something fails, and which facts anyone can check on chain.

## Who holds what

| Party | Holds | Does not hold |
| - | - | - |
| The owner | The key of the account, the funds, and the rule document. | |
| Your app | The draft of the document, if you keep it. | A key of the account. Funds. |
| The engine | The engine signature key and the engine encryption key, sealed in an Intel TDX enclave. The plaintext of each committed document. | A key of the account. Funds. |
| The Anafi API and the Anafi team | Account addresses and the records of payments. Sealed documents that it cannot read. | A key of the account. Funds. The engine keys. The plaintext of a document. |
| The off-ramp provider, for `off_ramp` only | The identity checks of the owner and the bank details of the payout. | A key of the account. |

The engine sees the account address, the rules, the triggers and the payees. When a bank payout runs, it also sees the payout details. It holds no identity data of the owner.

## What each party can do

### The engine

The engine signs payments. On chain, an adapter accepts a payment when the engine key signed it for this chain and this adapter, before its deadline, with an unused nonce. The engine signs only what a committed rule allows: the payees, the amounts, the triggers and the limits of the document.

[Redeem](https://docs.ana.fi/contracts/redeem.md) lists what each adapter checks on chain before it moves funds.

If a user doubts the engine, the user revokes. See [Leave without Anafi](#leave-without-anafi).

### The Anafi API and the Anafi team

The Anafi API relays sealed requests and submits signed payments. It cannot read a sealed document. Anafi can delay a payment; it can never read, redirect or create one. An open row of the activity feed shows a payment that waits.

### Contract roles

The roles of each contract, and who can change or upgrade it, are in the [Contracts overview](https://docs.ana.fi/contracts/overview.md).

### Your app

Your app builds documents and asks the owner to sign. It cannot move funds, and it cannot commit a document without the owner signature.

## Failure cases

| If | Then | What the owner can do |
| - | - | - |
| Anafi goes offline. | Nothing moves without an engine signature, and the funds stay in the account. A missed payment runs once, late, when the engine is back. | Nothing is needed. To stop, revoke. The revoke does not need Anafi. |
| Your app is breached. | The attacker gets no key of any account. A payment needs the engine signature, and the engine signs only what a committed rule allows. The attacker can build a document, but only the owner can commit it. | The wallet shows only the commitment hash, so show the full document to the owner before each sign step. Revoke if in doubt. |
| The owner wants out. | A revoke from the account removes the permission: one Safe transaction, or one `approve(adapter, 0)` for each token. It takes effect when it is confirmed. Nobody else must agree. | See [Leave without Anafi](#leave-without-anafi). |
| The balance is short. | The payment waits with `insufficient_funds`. If the balance does not come back before its deadline, the payment fails. Nothing moves. | Top up the account. The rule fires again at its next trigger. |
| A rule is wrong. | The engine checks each document at the stage step: syntax, units, tokens, the network and the account kind. A document that it refuses cannot be committed. A valid document with a wrong payee still pays that payee. | Show the full document, or a sentence for each rule, before the sign step. Use `global.recipient_allowlist` and `global.token_allowlist`. |
| Anafi is asked for data. | Anafi can hand over only what it holds: account addresses and the records of payments. A rule document is encrypted, and the Anafi team cannot read it. Identity checks stay with the off-ramp provider. | Nothing is needed. |

## Leave without Anafi

The permission lives in the account, so the owner removes it from the account. No Anafi contract, API or service takes part.

| Account kind | Revoke | SDK method |
| - | - | - |
| `safe_module` | One Safe transaction: `disableModule(prevModule, adapter)`. | `disableSafeModule` |
| `erc20_allow` | `approve(adapter, 0)` on each token that has an allowance. One transaction for each token. | `revokeErc20Allowances` |

> [!WARNING]
>
> Revoke the allowance to leave an `erc20_allow` account. The block switch and the caps do not remove the permission. See [Redeem](https://docs.ana.fi/contracts/redeem.md#nonce-and-deadline) for a payment that the engine signed before a revoke.

A gas credit in an adapter stays after the revoke. The owner claims it with `claimGasCredit(token, to)`. See [Fees](https://docs.ana.fi/concepts/fees.md#gas-credit) and [Redeem](https://docs.ana.fi/contracts/redeem.md).

## What you can verify yourself

All of these checks need only a node of the network. See [Verification](https://docs.ana.fi/contracts/verification.md) for the exact calls.

| Fact | How to check it |
| - | - |
| The document that the owner signed | Compute `keccak256(salt ‖ yaml)` of your copy, or of the read-back, and compare it with `commitments(account)` on the `AnafiDslRegistry`. |
| The engine identity | Read `engineSigKey()`, `engineEncKey()` and `composeHash()` on the `AnafiRegistry`. The `EngineIdentitySet` event carries the Intel TDX attestation of the engine. |
| That the engine is live and up to date | Read `lastHeartbeatBlock()` and `lastHeartbeatTick()` on the `AnafiRegistry`, or the `HeartbeatAttested` events. The engine signs a heartbeat every 30 minutes. A heartbeat records the last block that the engine processed. |
| Which adapters can move funds | Read `delegationAdapters()` on the `AnafiRegistry`. |
| The permission of an account | For a Safe: `isModuleEnabled(adapter)` on the Safe. For an `erc20_allow` account: `allowance(account, adapter)` on each token, and `isBlocked(account)` and `capOf(account, token)` on the adapter. |
| Each payment | The `EngineRedeemed`, `EngineRedeemFailed` and `GasCharged` events of the adapter. Each payment has a nonce. `usedNonces(nonce)` on the Safe adapter, or `isNonceUsed(nonce)` on the ERC20Allow adapter, shows that a nonce is spent. See [Redeem](https://docs.ana.fi/contracts/redeem.md#nonce-and-deadline) for the rules of the nonce. |

The contract addresses of each network are in [Deployments](https://docs.ana.fi/contracts/deployments.md).

## Security reviews

Hexens did a full-scope security review of Anafi, completed in October 2026. Read the [Hexens report](https://github.com/anafi-cc/trust-security/blob/main/reports/2026-10-hexens-security-review.pdf). Hakira did a penetration test. The [Trust and Security page](https://ana.fi/trust-security/) gives the scope of each review and a disclosure about the relation of Anafi to Hexens.

For questions about the trust model, write to [hi@ana.fi](mailto:hi@ana.fi).

## Related pages

* [How Anafi works](https://docs.ana.fi/concepts/how-anafi-works.md)
* [Accounts](https://docs.ana.fi/concepts/accounts.md)
* [Contracts overview](https://docs.ana.fi/contracts/overview.md)
* [Verification](https://docs.ana.fi/contracts/verification.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.