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

# Safe accounts

# Safe Accounts

An approval-only account owned by a Safe has no standing auth key: every spend
needs an on-chain approval from the Safe. Its identity keys are escrowed with
the server, which releases them to Safe owners after re-checking membership on
chain. The `safe` commands set up that identity and sign in as one of the
owners. See the
[approval-only trust model](https://docs.privacyboost.io/sdk/concepts/authentication.md#approval-only-trust-model)
for what the server can and can't do with the escrowed keys.

> [!NOTE]
>
> `safe prepare` runs locally and needs no key. `safe bootstrap`, `safe setup`,
> and `safe login` need the owner's wallet private key (the CLI prompts for it,
> or reads `PRIVATE_KEY`) and an RPC that can read the AuthRegistry. Every
> `safe` command prints JSON, whatever `--output` says.

## Recovery Phrase

The account is derived from a BIP-39 recovery phrase, which is its only
recovery path. Commands that need an existing phrase prompt for it without
echo. For runs without a terminal, set `PRIVACY_BOOST_MNEMONIC`; the CLI accepts
it with a warning, for the same reasons it warns about `PRIVATE_KEY`.

## Setting Up an Account

### 1. Derive the Account

```bash theme={null}
privacy-boost safe prepare --safe 0xYourSafeAddress
```

Output:

```
{"accountId":"<account-id>","accountSalt":"0x...","mnemonic":"<twelve words>"}
```

With no phrase given, `prepare` generates one and prints it this one time.
Store it offline before you continue. To recompute the account for a phrase you
already have, pass `--mnemonic` with no value and enter it at the prompt.

### 2. Create and Escrow

Either order works.

**Create first.** Have the Safe execute `AuthRegistry.createAccount(accountSalt)`,
then one owner runs the one-time setup, which registers the keys the phrase
derives and escrows them with the server:

```bash theme={null}
privacy-boost safe setup --safe 0xYourSafeAddress
```

```
{"mpk":"0x...","privacyAddress":"0x04...","status":"authenticated"}
```

Setup is write-once, and it refuses a phrase that derives a different account.

**Escrow first.** One owner runs `bootstrap`, which registers and escrows the
keys and prints the values the Safe needs for `createAccount`:

```bash theme={null}
privacy-boost safe bootstrap --safe 0xYourSafeAddress
```

```
{"accountExists":false,"accountId":"<account-id>","accountSalt":"0x...","authRegistryAddress":"0x..."}
```

Until the Safe executes the call, `safe login` reports
`accountCreationRequired` with the same values to every owner, so a lost
session can't orphan the account. `accountExists: true` means the Safe had
already created it.

## Signing In as an Owner

```bash theme={null}
privacy-boost safe login --safe 0xYourSafeAddress
```

| `status` | Meaning |
| - | - |
| `authenticated` | Signed in. Also prints `privacyAddress` and `mpk`. |
| `keysNotProvisioned` | The account exists on chain but setup hasn't run. |
| `accountCreationRequired` | `bootstrap` ran, but the Safe hasn't created the account yet. Prints `accountId`, `accountSalt`, and `authRegistryAddress`. |
| `accountNotFound` | The Safe has no approval-only account on chain. |

All four exit with code 0, so read `status` rather than the exit code.
`safe login` does not save a session for other commands.

| Option | Description |
| - | - |
| `--account-id <ID>` | The on-chain account id (`0x` hex or decimal). Needed when the Safe owns more than one account, or to avoid trusting the server's lookup. |
| `--auth-registry <ADDRESS>` | Pin the AuthRegistry instead of trusting server discovery. Also accepted by `setup` and `bootstrap`. |

## Next Steps

* [Commands Reference](https://docs.privacyboost.io/sdk/cli/guides/commands.md#safe-commands)
* [Authentication](https://docs.privacyboost.io/sdk/concepts/authentication.md)
* [Wallet Integration](https://docs.privacyboost.io/sdk/cli/guides/wallet-integration.md)


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