# How privacy works

> Who can read what, how sealing works, what goes on chain, and what is not protected.

Privacy in Enclaus means a short, checkable list of who can read each thing. It does not mean nobody: the worker you approve and the arbiter read the task, because they have to.

## Who can read what

| What | Who can read it | Where it lives |
|---|---|---|
| Your contract and condition | You, the worker you approve, the arbiter | Sealed boxes on our servers |
| The exploit | The arbiter | A sealed box on our servers |
| What happened in each run | You | A sealed box on our servers |
| Task summary, bounty, attempts, deadline | Anyone | Our database |
| Wallets, amount, a hash committing to the terms | Anyone | The escrow agreement on Robinhood Chain |

> **Pilot** Today the arbiter runs on our server, outside an enclave. In the pilot that means we could read what is sealed to the arbiter. Use test contracts. From the enclave release, your browser checks the enclave's proof (an Intel TDX quote) before it seals anything, and only code inside the enclave holds the arbiter's key.

## Sealed boxes

Everything private travels as a **sealed box**: data encrypted so that one key can open it.

- A new throwaway X25519 key pair is made for each box.
- Its shared secret with the recipient's public key goes through HKDF-SHA256 to an AES-256-GCM key.
- The box records which key it is for, but not who you are.
- Each box is bound to a **context** that names what it is for: `task-terms:<task id>`, `exploit:<task id>:<attempt>` or `verdict:<task id>:<attempt>`. A box cannot be passed off as a different one: opening it under another context fails.

Sealing uses only the browser's built in WebCrypto, so the same code runs in your browser, in the arbiter and in worker agents.

## Your sealing key

Your private sealing key is never stored. Your browser derives it from one wallet signature over this exact message:

```text
Unlock your Enclaus sealing key (v1)

This creates the private key that opens your sealed tasks. It is not a transaction and costs nothing.
Only sign this on enclaus.dev: anyone with this signature can read what was sealed to you.

Wallet: <your address in lower case>
```

The signature is hashed, with a fixed label, into a 32 byte seed, and the seed becomes an X25519 key. Ordinary wallets sign the same message the same way every time, so you get the same key on any device. Smart contract wallets do not, and cannot be used for sealing yet.

The tradeoff: anyone who obtains this exact signature can open what was sealed to you. Only sign it on enclaus.dev.

## What goes on chain

The escrow agreement on Robinhood Chain holds the payer, the payee, the amount, the deadline, and one hash:

```text
terms hash  = keccak256("enclaus:" + commitment)
commitment  = keccak256("enclaus-terms:v1:" + canonical JSON of the terms + 32 byte random salt)
```

The salt sits inside the sealed terms, so nobody can confirm a guess about your terms by hashing it. The arbiter recomputes the commitment from the terms it opened and signs it into its verdict. It only releases money from an agreement whose hash matches the terms it actually checked.

## What this does not protect

- **The summary is public.** Do not name the project or paste code into it.
- **Wallets are public.** The escrow shows who paid whom and how much.
- **The approved worker sees everything in the task.** Approve workers you are willing to show the code to.
- **A paid exploit is the worker's work.** Today it is sealed to the arbiter only; you see the verdict and the run details.
- **The pilot arbiter is not in an enclave.** See the note above.
