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

# Private Document Vault

> Next step after Get Started: the open-source Private Doc Scanner reads a passport, payslip or bank statement on the user's phone and seals the reviewed details to a vault in their tenant; your agent asks yes/no questions like income or age checks. Needs a phone and about 1,100 test credits.

> [!NOTE]
>
> **At a glance**
>
> * **What it does:** a user scans a passport, ID card, payslip or bank statement on their phone; only the details they review are sealed to their vault, and your agent gets yes/no answers such as "net pay at least 3,000?" or "passport not expired?".
> * **What it adds to your Get Started setup:** real documents instead of a hand-written record, read on the device with machine-readable-zone check digits, and checks re-run inside the enclave. Same key and tenant: the vault registers as `z:<tid>:doc-intake` next to your `vault`, and you grant your organisation agent `evaluate`.
> * **What you need:** a phone, the same email you claimed your key with, and about 1,100 test credits for the vault (once).
> * **Build ideas:** lending or rental pre-checks, age or residency gating, and booking flights with the scanned passport through [Flight Booking](https://docs.terminal3.io/developers/adk/use-cases/flight-booking.md).
> * **Sample repo:** [Terminal-3/private-doc-scanner](https://github.com/Terminal-3/private-doc-scanner)

[Private Doc Scanner](https://github.com/Terminal-3/private-doc-scanner) is an open-source app built on the same pattern as the [walkthrough vault](https://docs.terminal3.io/developers/adk/get-started/walkthrough/write-contract.md), with real documents. A user scans a passport, ID card, payslip or bank statement on their phone. The document is read **on the device**, the user reviews every field, and only the details they confirm are sealed to a contract in their own tenant. An agent can then ask questions such as "net pay at least 3,000?" or "passport not expired?" and gets yes/no answers. It never sees a value.

## How it builds on your setup

| What you have from Get Started | How the scanner uses it |
| - | - |
| Your key and `did:t3n` | Sign in to the scanner with the **same email** as your claim-page account, so the vault lands in your tenant |
| Your tenant `z:<tid>:…` | The vault registers as `z:<tid>:doc-intake`, beside your `vault` contract, with its own private `intake` map |
| Your organisation agent | Grant it `evaluate` on `z:<tid>:doc-intake`, exactly as you granted it `check` |
| The yes/no pattern | `evaluate` answers rules such as `min_net_pay`, `min_age`, `document_not_expired`, `nationality_in`, `min_closing_balance` |

What it adds: reading documents on the device (machine-readable zone check digits, cross-checks between the printed and machine-readable text), a review step, and checks re-run inside the enclave.

## Try it

1. **Scan, no account needed.** Open [the scanner](https://experiments-eta-ten.vercel.app/) on your phone, pick a document and take a photo. Nothing leaves the device at this point.
2. **Seal it.** At **Seal and send**, sign in with the email you used on the claim page. The first time, the scanner sets up your vault, which costs about 1,100 test credits once.
3. **Connect your coding assistant.** The [README](https://github.com/Terminal-3/private-doc-scanner#prompts-for-your-ai) has copy-and-paste prompts for Claude Code and Codex that set up the vault, create scan links and check what you sealed, without the documents or their values ever entering the chat.

## Let your agent use it

Grant your organisation agent `evaluate` (and `status`, if it should see which fields arrived) the same way as in [Store, grant and check](https://docs.terminal3.io/developers/adk/get-started/walkthrough/invoke-contract.md):

```typescript theme={null}
const VAULT = `z:${tenantDid.slice("did:t3n:".length)}:doc-intake`;

await t3n.updateMemberDelegation(
  fanOutGrant<BoundGrant>(
    { grantee: agentDid, contract_id: VAULT, scopes: [], allowed_hosts: [] },
    ["evaluate"],
  ),
);

// As the agent: one yes/no question about one sealed submission.
const answer = await invoke({
  baseUrl: getNodeUrl(),
  apiKey: process.env.AGENT_API_KEY!,
  request: {
    contract_id: VAULT,
    contract_version: await getContractVersion(getNodeUrl(), VAULT),
    function_name: "evaluate",
    pii_did: tenantDid,
    input: { request_id: "<the scanner reference>", rules: { min_net_pay: "3000.00", document_not_expired: true, require_verified: true } },
  },
});
// { request_id, all_pass, results: { min_net_pay: { pass, basis }, document_not_expired: { pass, basis } } }
```

`basis` says whether each answer rests on a value the scanner verified or one the user typed (`verified`, `self_attested` or `missing`). With `require_verified: true`, anything not verified fails.

## Ideas to build on it

* **Lending or rental pre-checks**: income and balance thresholds answered without collecting payslips or statements.
* **Age or residency gating** for a service an agent signs the user up to.
* **Booking with a sealed passport**: [Flight Booking](https://docs.terminal3.io/developers/adk/use-cases/flight-booking.md) can take the passport straight from this vault.


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