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

# Unio wallet

> Use the self-custodial Unio wallet in the UniFi app, a terminal, or Docker.

Unio is a self-custodial EVM wallet that can let a local agent request signatures without exposing
the wallet's private key. It is distributed through the UniFi app, a cross-platform terminal UI
(TUI), and a multi-architecture Docker image.

Every distribution uses the same encrypted-vault format and signing behavior. Unio currently
supports EIP-191 personal messages, EIP-712 typed data, and replay-protected legacy EVM
transactions on secp256k1 chains. Transaction signing returns a signed raw transaction; it does
not broadcast it.

> [!WARNING]
>
> A Unio access key authorizes signatures for as long as Agentic Mode is running, even when the
> interactive wallet is locked. Create a separate key for each agent, keep keys out of source
> control and logs, and revoke a key as soon as its agent no longer needs wallet access.

## Choose a distribution

> [card] [App](#1-app)
>
> Create and use a wallet in the UniFi native or web app. Agentic Mode requires the native desktop
> app.

> [card] [TUI](#2-terminal-ui-tui)
>
> Run an interactive local wallet on macOS, Windows, or Linux, on AMD64 or ARM64.

> [card] [Docker](#3-docker)
>
> Run the headless signing server as a non-root Linux container on AMD64 or ARM64.

The default Agentic Mode endpoint is the same in all three distributions:

```text theme={null}
http://localhost:34567/unio/server
```

## 1. App

Use this distribution when you already use Unio inside UniFi and want a graphical Agentic Mode
manager.

> [!NOTE]
>
> The Unio wallet works in both the native and web versions of the UniFi app. Agentic Mode works only
> in the native desktop app because a browser or installed PWA cannot host the local signing
> server.

### Set up the wallet

**1. Choose Unio at sign-up**

Open [Unio sign-up](https://payunifi.com/app/auth/signup?use=unio), then create a new wallet or
import an existing recovery phrase or private key.

**2. Protect the local vault**

Set a strong wallet password. If the native app offers biometric unlock, enable it for more
convenient owner verification. The wallet password remains available as a fallback.

**3. Secure the recovery backup**

Save the recovery backup to a directory you choose, move it to a secure offline location, and
remove any copy left in Downloads or a cloud-synchronized directory.

### Enable Agentic Mode

**1. Open Agentic Mode**

In the wallet sheet, select **Manage Agentic Mode**, or open `/unio` directly in the native app.
Only an account signed in with Unio can manage this page.

**2. Create an access key**

Enter a name that identifies one agent, select **Create key**, and complete biometric or wallet
password verification. Copy the new key immediately; Unio stores only its SHA-256 hash and
cannot reveal the original key later.

**3. Start the local server**

Select **Start server** and complete owner verification. The server binds to
`127.0.0.1:34567`, so it is reachable only from this device.

**4. Configure the agent**

Set `UNIO_SERVER_URL` and `UNIO_ACCESS_KEY` in the agent process using the values shown on the
page. See [Configure an agent](#configure-an-agent) for examples.

Creating or deleting a key and starting or stopping the server require owner verification. There
is no product-imposed limit on access keys. Deleting one revokes that agent immediately without
interrupting other keys. Starting Agentic Mode creates an isolated in-memory signer. Locking the
interactive wallet does not interrupt authorized agents; stopping Agentic Mode clears that signer.

The `/unio` page remains available offline and does not show the app's network-offline card. The
encrypted vault, server state, access-key metadata, access-key hashes, signing payloads, and
signatures stay on the device. Closing the native app stops its local signing server.

## 2. Terminal UI (TUI)

Use the TUI when you want the full wallet and Agentic Mode workflow without the graphical UniFi app.
It runs natively on macOS, Windows, and Linux.

### Choose an archive

Download the release archive and its `.sha256` file for your operating system and CPU:

| Operating system | AMD64 | ARM64 |
| - | - | - |
| macOS | `unio-macos-amd64.tar.gz` | `unio-macos-arm64.tar.gz` |
| Windows | `unio-windows-amd64.zip` | `unio-windows-arm64.zip` |
| Linux | `unio-linux-amd64.tar.gz` | `unio-linux-arm64.tar.gz` |

Expand your operating system, then select the tab matching your machine's architecture.

> [accordion] macOS: verify, extract, and run
>
> > [tab] ARM64 (Apple Silicon)
> >
> > ```sh theme={null}
> > shasum -a 256 -c unio-macos-arm64.tar.gz.sha256
> > tar -xzf unio-macos-arm64.tar.gz
> > ./unio
> > ```
>
> > [tab] AMD64 (Intel)
> >
> > ```sh theme={null}
> > shasum -a 256 -c unio-macos-amd64.tar.gz.sha256
> > tar -xzf unio-macos-amd64.tar.gz
> > ./unio
> > ```

> [accordion] Linux: verify, extract, and run
>
> > [tab] ARM64
> >
> > ```sh theme={null}
> > sha256sum -c unio-linux-arm64.tar.gz.sha256
> > tar -xzf unio-linux-arm64.tar.gz
> > ./unio
> > ```
>
> > [tab] AMD64
> >
> > ```sh theme={null}
> > sha256sum -c unio-linux-amd64.tar.gz.sha256
> > tar -xzf unio-linux-amd64.tar.gz
> > ./unio
> > ```

> [accordion] Windows: verify, extract, and run
>
> > [tab] ARM64
> >
> > ```powershell theme={null}
> > $expected = (Get-Content .\unio-windows-arm64.zip.sha256).Split()[0].ToLower()
> > $actual = (Get-FileHash .\unio-windows-arm64.zip -Algorithm SHA256).Hash.ToLower()
> > if ($actual -ne $expected) { throw "Unio archive checksum mismatch" }
> > Expand-Archive .\unio-windows-arm64.zip -DestinationPath .\unio
> > .\unio\unio.exe
> > ```
>
> > [tab] AMD64
> >
> > ```powershell theme={null}
> > $expected = (Get-Content .\unio-windows-amd64.zip.sha256).Split()[0].ToLower()
> > $actual = (Get-FileHash .\unio-windows-amd64.zip -Algorithm SHA256).Hash.ToLower()
> > if ($actual -ne $expected) { throw "Unio archive checksum mismatch" }
> > Expand-Archive .\unio-windows-amd64.zip -DestinationPath .\unio
> > .\unio\unio.exe
> > ```

### Command usage

The command-line interface has three commands. Expand a command to see its syntax and options. The
examples use `unio` as if it is on `PATH`; use `./unio` on macOS or Linux, or `.\\unio.exe` on
Windows, when running directly from the extracted directory.

> [accordion] unio / unio tui — open the interactive wallet
>
> `tui` is the default command, so these are equivalent:
>
> ```sh theme={null}
> unio
> unio tui
> ```
>
> Use a specific local wallet directory with the global `--data-dir` option:
>
> ```sh theme={null}
> unio --data-dir /secure/path/unio-data
> unio tui --data-dir /secure/path/unio-data
> ```
>
> `UNIO_DATA_DIR` provides the same setting through the process environment. An explicit
> `--data-dir` takes precedence. Set `NO_COLOR=1` to use plain terminal output.

> [accordion] unio serve — run the headless signing server
>
> ```text theme={null}
> unio serve [--bind <IP:PORT>] [--password-file <PATH>] [--allow-non-loopback]
> ```
>
> With no options, `serve` binds to `127.0.0.1:34567` and prompts for the wallet password:
>
> ```sh theme={null}
> unio serve
> ```
>
> For automation, read the password from an owner-readable local file or Docker secret:
>
> ```sh theme={null}
> unio serve --password-file /secure/path/unio-password
> ```
>
> `--allow-non-loopback` is required with a non-loopback `--bind` value. Use that exception only
> inside a container whose published host port remains restricted to `127.0.0.1`.

> [accordion] unio health — check the signing server
>
> The default address is `127.0.0.1:34567`:
>
> ```sh theme={null}
> unio health
> ```
>
> Check another local address when the server uses a custom bind:
>
> ```sh theme={null}
> unio health --address 127.0.0.1:45678
> ```

> [accordion] Help and version commands
>
> ```sh theme={null}
> unio --help
> unio tui --help
> unio serve --help
> unio health --help
> unio --version
> ```

### Set up Agentic Mode

**1. Initialize the encrypted vault**

Start `unio`, choose **Initialize wallet**, and enter a strong wallet password.

**2. Add the EVM account**

Create a new wallet, import a recovery phrase, or import a private key. Unio is a single-account
wallet. When creating a wallet, save its recovery backup to a secure custom directory and move
it offline.

**3. Create an access key**

Choose **Create access key**, enter a descriptive agent name, complete owner verification, and
copy the key when it is displayed. It cannot be shown again.

**4. Start the signing server**

Choose **Start signing server** and complete owner verification. Leave this TUI process running
while the agent uses the wallet.

**5. Configure the agent**

Give the local agent the displayed API URL and the access key. See
[Configure an agent](#configure-an-agent).

On macOS, the first successful password unlock offers to enable Touch ID. The credential remains
in the local, non-synchronizing Keychain and is released only after Touch ID verifies the currently
enrolled biometric set. Later unlocks try Touch ID first and retain wallet-password fallback.
Windows and Linux currently use the wallet password.

The TUI displays its local data directory at the top of the screen. Override it with `--data-dir`
or `UNIO_DATA_DIR` as shown in [Command usage](#command-usage). Do not place this directory in
source control or a cloud-synchronized folder. Destroying the wallet stops Agentic Mode and deletes
every local access-key record.

### Run headlessly without Docker

After setting up the wallet and at least one access key in the TUI, use `unio serve` as described
in [Command usage](#command-usage). Put only the wallet password in a local, owner-readable file;
do not pass it in an environment variable or command-line argument.

## 3. Docker

Use Docker when the Unio signing server should run as an isolated, restartable local service. The
image runs as an unprivileged user, stores its encrypted state only under `/data`, and supports
Linux AMD64 and ARM64. Docker automatically selects the correct image from the multi-architecture
manifest.

> [!WARNING]
>
> A container cannot use the host's Touch ID, Face ID, Windows Hello, or Linux biometric service.
> Docker uses the wallet-password file. Keep that file outside source control with owner-only
> permissions.

### Run the one-command launcher

The launcher is the recommended Docker workflow on AMD64 and ARM64 macOS or Linux. It pulls
`abhi3700/unio:latest`, selects the matching architecture, creates a persistent `unio-data` volume,
guides first-time setup, and publishes the API only on host loopback.

> [tab] Source checkout
>
> Run from the UniFi Echo repository root:
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh
> ```

> [tab] Release folder
>
> Run the packaged launcher:
>
> ```sh theme={null}
> cd docker
> ./docker-run.sh
> ```

On macOS, the launcher can discover or install the Homebrew Docker CLI and Colima and start Colima
when no Docker daemon is available. Linux requires an installed, accessible Docker engine. The
first run opens the TUI because the wallet password, recovery backup, wallet, and first access key
must be created interactively. Choose `/data/recovery` as the custom recovery-backup directory so
the launcher can copy the backup to the host.

After setup, the launcher reports the local URL:

```text theme={null}
Unio is ready: http://127.0.0.1:34567/unio/server
```

The examples below use the source-checkout path. If you are in the release bundle's `docker/`
directory, replace `./unio/scripts/docker-run.sh` with `./docker-run.sh`. Expand an operation for
its command and expected behavior.

> [accordion] Show launcher help and configuration
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh --help
> ```
>
> ```text theme={null}
> Usage:
>   ./scripts/docker-run.sh [options]
>   ./scripts/docker-run.sh --setup
>   ./scripts/docker-run.sh --status | --logs | --stop
>
> Options:
>   --image <image>       Multi-architecture image (default: abhi3700/unio:latest)
>   --port <port>         Host loopback port (default: 34567)
>   --setup               Open the TUI before starting the signing server
>   --no-pull             Use an image already present in the Docker engine
>   --status              Show the managed container and health status
>   --logs                Follow the managed container logs
>   --stop                Stop the managed container without deleting wallet data
>   -h, --help            Show this help
> ```
>
> Environment overrides are available for the image, host port, container and volume names,
> password file, Docker configuration directory, recovery directory, and fallback image version.

> [accordion] Open setup to manage the wallet or access keys
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh --setup
> ```
>
> The launcher stops and replaces its managed server container, opens the TUI against the
> existing `unio-data` volume, and starts a fresh headless server after the TUI exits. Use this
> flow to initialize or destroy the wallet and to create or revoke access keys. Existing wallet
> data remains intact unless you explicitly select **Destroy wallet**.

> [accordion] Check container and server health
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh --status
> ```
>
> A healthy result shows the `unio` container, a loopback mapping such as
> `127.0.0.1:34567->34567/tcp`, and `healthy`.

> [accordion] Follow signing-server logs
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh --logs
> ```
>
> Representative startup output:
>
> ```text theme={null}
> Unio signing server listening at 0.0.0.0:34567/unio/server
> Wallet: 0x...
> Press Ctrl-C to stop Unio.
> ```
>
> `0.0.0.0` is the bind address inside the container. The launcher still publishes the host port
> only on `127.0.0.1`. Pressing **Ctrl+C** stops log following, not the container.

> [accordion] View the externally managed wallet
>
> With the default container name:
>
> ```sh theme={null}
> docker exec -it unio unio
> ```
>
> The TUI reports **Running externally** and is intentionally read-only because the headless
> process owns the signer, wallet data, and server lifecycle. Quitting this view leaves the
> background server running. Use `./unio/scripts/docker-run.sh --setup` for supported wallet or
> access-key changes.

> [accordion] Inspect server identity and capabilities
>
> ```sh theme={null}
> curl --silent http://127.0.0.1:34567/unio/server | jq .
> ```
>
> ```json theme={null}
> {
>   "name": "Unio Agentic signing server",
>   "version": "0.1.0",
>   "localOnly": true,
>   "signingPath": "/unio/server",
>   "authentication": "Authorization: Bearer <UNIO_ACCESS_KEY>",
>   "capabilities": [
>     "eip191_personal_message",
>     "eip712_typed_data",
>     "evm_legacy_transaction"
>   ]
> }
> ```
>
> This discovery request needs no access key and exposes no wallet secret.

> [accordion] Stop Unio without deleting wallet data
>
> ```sh theme={null}
> ./unio/scripts/docker-run.sh --stop
> ```
>
> The managed container stops while the encrypted wallet and access-key hashes remain in the
> `unio-data` volume. Run the launcher again to replace and restart the server.

### Manual Docker workflows

> [accordion] Use docker run directly
>
> Set a pinned image version, create a persistent volume, and open the TUI in a temporary
> container:
>
> ```sh theme={null}
> export UNIO_IMAGE=abhi3700/unio:<version>
> docker volume create unio-data
> docker run --rm -it \
>   --volume unio-data:/data \
>   "$UNIO_IMAGE" tui
> ```
>
> Initialize or import the single EVM account, save any recovery backup to a secure host-mounted
> directory, create a separately named access key for each agent, and then exit. The temporary
> container is removed; the encrypted vault and key hashes remain in `unio-data`.
>
> Create `unio-password.txt` in a local editor with only the wallet password, then restrict it on
> macOS or Linux:
>
> ```sh theme={null}
> chmod 600 unio-password.txt
> ```
>
> Start the service with the API port published only on host loopback:
>
> ```sh theme={null}
> docker run --detach \
>   --name unio \
>   --restart unless-stopped \
>   --publish 127.0.0.1:34567:34567 \
>   --volume unio-data:/data \
>   --mount type=bind,src="$PWD/unio-password.txt",dst=/run/secrets/unio_password,readonly \
>   "$UNIO_IMAGE"
> docker exec unio unio health --address 127.0.0.1:34567
> ```
>
> Never change the publication to `34567:34567` on a shared or internet-connected host. To manage
> the same wallet later, stop the server before mounting its volume in the TUI:
>
> ```sh theme={null}
> docker stop unio
> docker run --rm -it --volume unio-data:/data "$UNIO_IMAGE" tui
> docker start unio
> ```
>
> Only one Unio process should mount the data volume at a time.

> [accordion] Use the included Compose file
>
> From the Unio source directory, `compose.yaml` provides the same persistent volume, password
> secret, and loopback-only port:
>
> ```sh theme={null}
> docker compose build
> docker compose run --rm --service-ports unio tui
> docker compose up -d
> docker compose exec unio unio health --address 127.0.0.1:34567
> ```
>
> The Compose setup reads the password from `unio-password.txt`, which is ignored by the
> repository. Stop the service before opening another TUI against its volume.

## Configure an agent

After starting Agentic Mode with any distribution, provide these values to the agent process. Do not
commit them to a repository or write the access key to application logs.

On macOS or Linux:

```sh theme={null}
export UNIO_SERVER_URL=http://localhost:34567/unio/server
export UNIO_ACCESS_KEY='unio_...'
```

On Windows PowerShell:

```powershell theme={null}
$env:UNIO_SERVER_URL = "http://localhost:34567/unio/server"
$env:UNIO_ACCESS_KEY = "unio_..."
```

The Rust client examples in the standalone Unio repository read these variables without
persisting either value:

```sh theme={null}
cargo run --features client --example sign_message -- "Sign this exact message"
cargo run --features client --example sign_eip712
cargo run --features client --example sign_transaction
```

## Request signatures

Send signing requests to `POST $UNIO_SERVER_URL` with the access key as a bearer credential.

### EIP-191 personal message

```sh theme={null}
curl "$UNIO_SERVER_URL" \
  -H "Authorization: Bearer $UNIO_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "type": "personal_message",
    "message": "Sign this exact message"
  }'
```

### EIP-712 typed data

Pass the complete typed-data object in `typedData`:

```json theme={null}
{
  "type": "eip712",
  "typedData": {
    "types": {
      "EIP712Domain": [
        { "name": "name", "type": "string" },
        { "name": "version", "type": "string" },
        { "name": "chainId", "type": "uint256" }
      ],
      "AgentRequest": [
        { "name": "action", "type": "string" },
        { "name": "requestId", "type": "bytes32" }
      ]
    },
    "primaryType": "AgentRequest",
    "domain": { "name": "My agent", "version": "1", "chainId": 1 },
    "message": {
      "action": "Approve agent action",
      "requestId": "0x0000000000000000000000000000000000000000000000000000000000000001"
    }
  }
}
```

### EVM transaction

Quantity fields use standard RPC hexadecimal form. The response contains the signed raw
transaction; the calling agent remains responsible for simulation and broadcasting.

```json theme={null}
{
  "type": "evm_transaction",
  "transaction": {
    "chainId": 1,
    "nonce": "0x0",
    "gasPrice": "0x3b9aca00",
    "gasLimit": "0x5208",
    "to": "0x000000000000000000000000000000000000dEaD",
    "value": "0x0",
    "data": "0x"
  }
}
```

### Successful response

A message or EIP-712 request returns `resultType: "signature"`. A transaction request returns
`resultType: "raw_transaction"`.

```json theme={null}
{
  "address": "0x...",
  "result": "0x...",
  "resultType": "signature"
}
```

Use `GET $UNIO_SERVER_URL` without an access key to inspect server version and capabilities.

## Locking, revocation, and errors

* Locking the interactive wallet does not interrupt a running Agentic Mode server.
* Stopping Agentic Mode closes the listener after owner verification.
* Deleting an access key revokes it immediately, including while the server is running.
* Destroying the wallet stops Agentic Mode and deletes every access-key record.
* `401 Unauthorized` means the access key is missing or invalid.
* `422 Unprocessable Entity` means the signing payload is invalid.
* `503 Service Unavailable` means the local signer is unavailable.

## Local security model

| Distribution | Encrypted wallet location | Owner verification | Network exposure |
| - | - | - | - |
| App | Native app data on the device | Device biometrics when configured, with wallet-password fallback | Loopback only |
| TUI | Platform application-data directory or `UNIO_DATA_DIR` | Touch ID on macOS when configured; wallet password on every platform | Loopback only |
| Docker | Persistent `/data` volume | Password file mounted read-only | Host loopback by default |

Unio never sends the wallet password, recovery phrase, private key, or access key to a UniFi
server. The encrypted vault and SHA-256 access-key hashes remain on the device running Unio. A new
access key is displayed once, and the original value cannot be recovered from its stored hash.


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