# Independent recovery kit

Download and keep `recovery.html`, `read-record.html`, `manifest.json` and the source archive while you can still access the distribution site. The private recovery key is a separate file. Keep it secret: it can decrypt available records belonging to the account, not just one QR. A compromised distributor can replace both code and hashes; a hash detects accidental changes only when compared with a separately trusted copy. Review the source and retain a known copy.

## Recover a base destination

1. In the authenticated EQR Dashboard or Profile, explicitly export the private key. Save the key text file and public QR-ID metadata separately. An export does not prove that you retained a usable backup. The existing export rate limit and audit still apply.
2. Open the downloaded `read-record.html`. Supply your exact canonical QR ID (case sensitive), expected chain ID, registry address and a public read-only RPC. Optional app metadata lists owned IDs; it does not establish the correct registry. The historical Base preset is only a documented past deployment, not current configuration evidence. This stage needs network access. The RPC sees the QR ID and your IP address; its URL appears in the snapshot. Never use an endpoint containing credentials or a private API token. Query strings, fragments and HTTP outside loopback are rejected.
3. Explicitly read the record and download its public JSON snapshot. The reader makes at most five sequential JSON-RPC requests within eight seconds, checks chain ID and bytecode and rechecks the observed block hash. It pins reads to one block number. RPC data remains trusted input, without independently verified state proofs or finality guarantees. A changed block discards the whole attempt; retry explicitly.
4. Open the separate downloaded `recovery.html`, ideally after disconnecting from the network. Import the public snapshot (or legacy raw ciphertext) and paste/import the raw exported Base64 key. The AES key is imported as non-extractable, without repeating HKDF. The file has no external dependencies or RPC code; its CSP denies network connections, workers, forms, images and fonts. There is no telemetry, persistence or automatic navigation. A manually clicked safe HTTP(S) link can open a new tab.
5. Check the result and provenance. Clearing releases page references and the display; browsers cannot promise forensic memory erasure. No plaintext or key is saved in browser storage. Downloaded key files, clipboard content and memory remain your responsibility.

Web Crypto needs a supported secure context. If opening a file is unsupported in your browser, serve the downloaded directory locally:

```sh
python3 -m http.server 8786 --bind 127.0.0.1 --directory /path/to/recovery-kit
```

Then open `http://127.0.0.1:8786/recovery.html` in a supported browser. The key is processed by browser code; the static HTTP server receives no key request. Stop the server after use. Browser support for `file://`, RPC CORS and secure contexts varies; a failed feature check must be resolved before recovery is claimed. There is no custom crypto fallback.

## What is and is not recovered

The historical format is standard Base64 of `12-byte nonce || AES-256-GCM ciphertext || 16-byte authentication tag`, without additional authenticated data. Existing raw 32-byte Base64 exports are accepted, including a single final text-file line ending. Keys are already derived by EQR: never derive them again, treat them as wallet/signing keys or upload them to an RPC.

A valid decryption proves consistency of key and ciphertext. The old format does not authenticate QR ID, chain, registry, owner address or block metadata. The contract owner commonly identifies the relayer, not the customer. QR IDs cannot be enumerated from a key or the V1 indexed-string event. Keep your canonical IDs; a vanity alias may differ. App-supplied status and transaction hashes are hints only.

Only the last observed anchored **base destination** is available. Pending or failed re-anchoring can leave an older destination on-chain. After a transfer, the new key can fail on an old anchor while a write is pending; old keys can still reveal old ciphertext. A Basic record may have no anchor. Shared QR records owned by another account are excluded from the export metadata. Empty metadata or metadata failure permits manual ID entry and does not invalidate the private key.

Passwords, pause/archive state, device/time/geo/A-B/localization routes, lead forms, scan limits, analytics, pixels, branding and hosted file bytes are not restored. An unavailable hosted-file URL does not recover its file. Hosting a replacement resolver cannot change an already printed `eqr.link` URL. Original-domain renewal, trustee/escrow arrangements, provider and chain availability remain separate continuity work. This kit is a recovery mechanism, not a hosting or permanence guarantee.

## Optional Node 22+ reader and self-hosted resolver

Extract `eqr-recovery-source.tar.gz`. The CLI and resolver use Node built-ins only; no installation, EQR account service, database, master key, relayer, signing or billing access is required.

```sh
node cli.mjs https://PUBLIC-RPC.example 8453 0xYOUR_REGISTRY YOUR_QR_ID > public-record.json
chmod 600 /private/path/eqr-recovery-key.txt
node resolver.mjs /private/path/resolver-config.json
```

Configure an explicit finite allowlist. The following values are placeholders, not deployment defaults:

```json
{
  "format": "eqr-resolver-config/v1",
  "acknowledgeBaseDestinationOnly": true,
  "keyFile": "eqr-recovery-key.txt",
  "rpc": "https://PUBLIC-RPC.example",
  "chainId": "8453",
  "registry": "0x1111111111111111111111111111111111111111",
  "listenHost": "127.0.0.1",
  "port": 8787,
  "records": [{ "alias": "my-code", "qrId": "ExactQrID" }]
}
```

Opening `/my-code` explicitly redirects to the recovered base destination. Enabling this can bypass access restrictions formerly enforced by hosted password/pause modules: acknowledge the limited behavior before operating it. The resolver never fetches, previews or proxies the destination. It accepts only configured aliases, GET/HEAD, bounded HTTP headers and no request body/query/path encoding. It never accepts per-request keys, RPC endpoints, registry addresses or filesystem paths. It reads a regular, current-user-owned key file with no group/other permissions once at startup. Its imported key is non-extractable.

The default bind is loopback. External hosting requires an explicit `listenHost` of `0.0.0.0` or `::` plus `allowExternalListen: true`. The operator is responsible for TLS, reverse proxy, domain ownership, DNS and any access policy. This source package does not deploy or configure infrastructure. Protect operator config and private files; never serve the source directory as the resolver's document root.

The resolver allows at most four concurrent reads and 32 connections, with no waiting queue. Its bounded cache has 128 entries: successful destinations live for 30 seconds, missing/error results for five seconds. Unknown aliases and observed absent records return 404; RPC, decryption and unsafe destination failures return 503 with retry advice; saturation returns 503. No false missing result substitutes for an RPC error. Cached state can lag chain edits; it is not a current-state proof. HTTP requests, key data and destinations are not logged. Stop with SIGINT/SIGTERM; restart requires the same protected configuration and key.

## Source and verification

`core.mjs` defines bounded Base64/AES and the fixed V1/V2 `getRecord(string)` ABI. `rpc.mjs` is key-free. `browser/offline.mjs` imports no RPC or app code. The archive includes the actual standalone HTML and source hashes. `manifest.json` records artifact SHA-256 hashes and a content-derived source build identifier; it is not a signature or provenance attestation.

In the full repository, run `npm ci` in `frontend`, then `npm run recovery:test` and `npm run recovery:build`. Full frontend builds run these gates and copy the generated files into the distributed `/.well-known/eqr-recovery/` directory. Contract integration tests compare the codec against ethers and both real registry contracts on a local synthetic Hardhat network. Compatibility vectors are generated by the production Go crypto source, not a second invented encryption implementation. No mainnet writes or real account keys are used for this verification.

Primary format references: [Web Crypto AES-GCM](https://www.w3.org/TR/2017/REC-WebCryptoAPI-20170126/#aes-gcm) and [Solidity 0.8.24 ABI](https://docs.soliditylang.org/en/v0.8.24/abi-spec.html). These specify formats; they do not verify any EQR deployment or distribution channel.
