panel-unlock 5b/7 — the steward bundle mints the sealing key and opens the sealed passcode (the phone unlock's missing half, #1929) #1938

Closed
opened 2026-09-27 21:20:52 +00:00 by matou-build-agent · 2 comments

Parent

  • Spec: #1929 — panel unlock (stories 1, 3, 7, 13, 15 — the crypto half)
  • Completes: #1934, which declared these two verbs and built the whole panel state machine against them, but left them unimplemented in the bundle.
  • Design: ADR 0282 d.6 · flow docs/ux/flows/panel-unlock.mermaid · wireframes panel-unlock/pu-m0q-*, pu-m0x-*

What to build

#1934 shipped the panel's phone unlock at the dashboard seam: PhoneUnlockScreen, the
waiting/failed/mismatch states, and a handover port whose two verbs are declared on the steward
bundle's interface —

mintSealingKey(): { publicKey: string; fingerprint: string };
unlockFromSealedBox(req: { sealedPasscode: string; expectedAid: string }): Promise<void>;

Nothing implements them. They appear only in dashboard/src/lib/idip.ts,
signingSession.ts and three test files; the bundle mounted on window.idssKeriSteward
(app/src/keriweb/main.ts) still exposes only approve / issue / revoke / unlock(phrase) / lock /
isUnlocked / ledgerMembers. So the panel's phone unlock is unit-green and cannot work in a real
browser
— the production loader would find both verbs undefined. This ticket builds them, the
way #1930 built the ledger read: real code in the bundle, proven at app/tests/unit.

The shape to build (settled — verified against the installed signify-ts)

crypto_box_seal is not exported by signify-ts, but Encrypter, Decrypter and Cipher are
(dist/exports.js), and signify's own Controller already performs exactly this handover:

// signify-ts keri/app/controller.js — the precedent
this.bran = MtrDex.Salt_128 + 'A' + bran.substring(0, 21);  // '0A' + 'A' + 21 chars
const sxlt = encrypter.encrypt(b(this.bran)).qb64;          // X25519_Cipher_Salt ('1AAH')

Encrypter accepts an Ed25519 verkey and converts it to X25519 itself; Decrypter accepts an
Ed25519 seed and does the same. So:

  • mintSealingKey() mints a fresh Ed25519 Signer in bundle memory and returns its verkey
    qb64
    as publicKey (what rides ek=) plus the short fingerprint PU-M0q prints. Each call
    replaces any prior key; a page holds at most one; nothing is written anywhere.
  • unlockFromSealedBox() opens the wallet's cipher with new Decrypter({}, seedQb64b) →
    a Salter → the bran, connects as a signify client of the steward's agent, and asserts the
    connected agent AID equals expectedAid
    .

Neither side imports libsodium. matou-app#663 carries the sealing half of this same contract.

Correct the stale wording in the same PR: dashboard/src/lib/idip.ts and
dashboard/src/lib/handoverPort.ts describe "a fresh X25519 keypair" and "a libsodium sealed box"
(ADR 0282 d.6's literal phrasing, written before this was settled), and ADR 0282 d.6 itself says
the tab "mints a throwaway X25519 key pair". The material is an Ed25519 seed whose verkey rides
ek=; the cipher is CESR qb64, not raw bytes. No behaviour changes — the door relays both as
opaque strings (appdoor.go, #1933).

Acceptance criteria

  • Given the bundle is loaded, when the dashboard calls either verb through the production loader, then both exist on window.idssKeriSteward and satisfy the declared interface — no undefined at runtime.
  • Given mintSealingKey(), when called, then it returns an Ed25519 verkey qb64 as publicKey plus a short fingerprint, holding the seed in memory only.
  • Given two calls to mintSealingKey(), when compared, then the second replaces the first and returns a different key — a page holds at most one.
  • Given a cipher sealed to the minted key by signify's Encrypter (the wallet's half), when unlockFromSealedBox() runs, then the passcode is recovered, the client connects, and isUnlocked() → true.
  • Given the connected agent's AID is not expectedAid, when the check runs, then the passcode is discarded, the seat stays locked, and { kind: 'agent-mismatch' } is thrown — no retry, no continue-anyway.
  • Given a malformed, truncated or wrongly-keyed cipher, when opened, then it throws and the seat stays locked; the failure is distinguishable from the mismatch above.
  • Given any path, then nothing — seed, cipher or passcode — is written to localStorage, sessionStorage, IndexedDB or a log, and no plaintext passcode appears in a thrown message.
  • Given await ready() has not run, when a verb is called, then it initialises libsodium first rather than throwing (signify's Encrypter/Decrypter require it).
  • A round-trip golden shared with matou-app#663 pins the pad position: signify's Controller builds '0A' + 'A' + bran, while app/src/lib/keri/derivation.ts recovers a bran with substring(2, 23). Both are 21 bran chars either side of one pad, but one prepends and the other trims — a seal-then-open test over a fixed vector must prove the recovered bran is byte-identical to the sealed one.
  • The stale wording in idip.ts, handoverPort.ts and ADR 0282 d.6 is corrected; STATUS.md updated in the same commit.

Blocked by

  • None — can start immediately. #1934 (closed) declared the interface this implements.

Task manifest

task: bundle-sealing-verbs
implements_flow: panel-unlock
implements_edge: A2u->M1 / A4->M1 (the crypto half), M1->M0x (agent mismatch)
wireframe:
  - docs/ux/wireframes/panel-unlock/pu-m0q-approve-on-your-phone.html
  - docs/ux/wireframes/panel-unlock/pu-m0x-couldnt-unlock.html
interface: |
  mintSealingKey(): { publicKey: string; fingerprint: string }
  # publicKey = Ed25519 VERKEY qb64 (rides ek=); seed held in bundle memory, one per page
  unlockFromSealedBox(req: { sealedPasscode: string; expectedAid: string }): Promise<void>
  # Decrypter({}, seedQb64b).decrypt(cipherQb64) -> Salter -> bran; connect;
  # assert agent AID == expectedAid, else discard + throw { kind: 'agent-mismatch' }
seam: app/tests/unit (bundle verbs over fixed vectors, no container, no network)
acceptance:
  - given: a cipher sealed to the minted key by signify's Encrypter
    when: unlockFromSealedBox runs
    then: the passcode is recovered, the client connects, isUnlocked() is true
  - given: the connected agent AID is not expectedAid
    when: the check runs
    then: the passcode is discarded, the seat stays locked, agent-mismatch is thrown
  - given: two mintSealingKey calls
    when: compared
    then: the second replaces the first and differs
  - given: a seal-then-open round trip over a fixed vector
    when: the bran is recovered
    then: it is byte-identical to the one sealed (pins the pad position)
depends_on: [1934]
out_of_scope:
  - the wallet's sealing side (matou-app#663)
  - the door's relay (idss#1933, landed)
  - any panel screen or state (idss#1934, landed)
needs_human_decision: []

Filed by /to-tickets follow-up on spec #1929 after #1934 closed with these verbs declared but unimplemented; Ben confirmed filing and the #1936 edge 2026-09-27.

🤖 Generated with Claude Code

https://claude.ai/code/session_015es4bpK4qRqZhrRYQBWCiY

## Parent - **Spec:** [#1929 — panel unlock](https://git.matou.nz/Matou/idss/issues/1929) (stories 1, 3, 7, 13, 15 — the crypto half) - **Completes:** #1934, which declared these two verbs and built the whole panel state machine against them, but left them unimplemented in the bundle. - **Design:** ADR 0282 d.6 · flow `docs/ux/flows/panel-unlock.mermaid` · wireframes `panel-unlock/pu-m0q-*`, `pu-m0x-*` ## What to build #1934 shipped the panel's phone unlock at the **dashboard seam**: `PhoneUnlockScreen`, the waiting/failed/mismatch states, and a handover port whose two verbs are declared on the steward bundle's interface — ```ts mintSealingKey(): { publicKey: string; fingerprint: string }; unlockFromSealedBox(req: { sealedPasscode: string; expectedAid: string }): Promise<void>; ``` **Nothing implements them.** They appear only in `dashboard/src/lib/idip.ts`, `signingSession.ts` and three test files; the bundle mounted on `window.idssKeriSteward` (`app/src/keriweb/main.ts`) still exposes only approve / issue / revoke / unlock(phrase) / lock / isUnlocked / ledgerMembers. So the panel's phone unlock is unit-green and **cannot work in a real browser** — the production loader would find both verbs undefined. This ticket builds them, the way #1930 built the ledger read: real code in the bundle, proven at `app/tests/unit`. ### The shape to build (settled — verified against the installed signify-ts) `crypto_box_seal` is **not** exported by signify-ts, but `Encrypter`, `Decrypter` and `Cipher` are (`dist/exports.js`), and signify's own `Controller` already performs exactly this handover: ```js // signify-ts keri/app/controller.js — the precedent this.bran = MtrDex.Salt_128 + 'A' + bran.substring(0, 21); // '0A' + 'A' + 21 chars const sxlt = encrypter.encrypt(b(this.bran)).qb64; // X25519_Cipher_Salt ('1AAH') ``` `Encrypter` accepts an **Ed25519 verkey** and converts it to X25519 itself; `Decrypter` accepts an **Ed25519 seed** and does the same. So: - **`mintSealingKey()`** mints a fresh Ed25519 `Signer` in bundle memory and returns its **verkey qb64** as `publicKey` (what rides `ek=`) plus the short fingerprint PU-M0q prints. Each call replaces any prior key; a page holds at most one; nothing is written anywhere. - **`unlockFromSealedBox()`** opens the wallet's cipher with `new Decrypter({}, seedQb64b)` → a `Salter` → the bran, connects as a signify client of the steward's agent, and **asserts the connected agent AID equals `expectedAid`**. Neither side imports libsodium. matou-app#663 carries the sealing half of this same contract. **Correct the stale wording in the same PR:** `dashboard/src/lib/idip.ts` and `dashboard/src/lib/handoverPort.ts` describe "a fresh X25519 keypair" and "a libsodium sealed box" (ADR 0282 d.6's literal phrasing, written before this was settled), and ADR 0282 d.6 itself says the tab "mints a throwaway X25519 key pair". The material is an Ed25519 seed whose **verkey** rides `ek=`; the cipher is CESR qb64, not raw bytes. No behaviour changes — the door relays both as opaque strings (`appdoor.go`, #1933). ## Acceptance criteria - [ ] **Given** the bundle is loaded, **when** the dashboard calls either verb through the production loader, **then** both exist on `window.idssKeriSteward` and satisfy the declared interface — no undefined at runtime. - [ ] **Given** `mintSealingKey()`, **when** called, **then** it returns an Ed25519 **verkey qb64** as `publicKey` plus a short fingerprint, holding the seed in memory only. - [ ] **Given** two calls to `mintSealingKey()`, **when** compared, **then** the second replaces the first and returns a different key — a page holds at most one. - [ ] **Given** a cipher sealed to the minted key by signify's `Encrypter` (the wallet's half), **when** `unlockFromSealedBox()` runs, **then** the passcode is recovered, the client connects, and `isUnlocked()` → true. - [ ] **Given** the connected agent's AID is **not** `expectedAid`, **when** the check runs, **then** the passcode is discarded, the seat stays locked, and `{ kind: 'agent-mismatch' }` is thrown — no retry, no continue-anyway. - [ ] **Given** a malformed, truncated or wrongly-keyed cipher, **when** opened, **then** it throws and the seat stays locked; the failure is distinguishable from the mismatch above. - [ ] **Given** any path, **then** nothing — seed, cipher or passcode — is written to `localStorage`, `sessionStorage`, IndexedDB or a log, and no plaintext passcode appears in a thrown message. - [ ] **Given** `await ready()` has not run, **when** a verb is called, **then** it initialises libsodium first rather than throwing (signify's `Encrypter`/`Decrypter` require it). - [ ] **A round-trip golden shared with matou-app#663 pins the pad position:** signify's `Controller` builds `'0A' + 'A' + bran`, while `app/src/lib/keri/derivation.ts` recovers a bran with `substring(2, 23)`. Both are 21 bran chars either side of one pad, but one prepends and the other trims — a seal-then-open test over a fixed vector must prove the recovered bran is byte-identical to the sealed one. - [ ] The stale wording in `idip.ts`, `handoverPort.ts` and ADR 0282 d.6 is corrected; STATUS.md updated in the same commit. ## Blocked by - None — can start immediately. #1934 (closed) declared the interface this implements. ## Task manifest ```yaml task: bundle-sealing-verbs implements_flow: panel-unlock implements_edge: A2u->M1 / A4->M1 (the crypto half), M1->M0x (agent mismatch) wireframe: - docs/ux/wireframes/panel-unlock/pu-m0q-approve-on-your-phone.html - docs/ux/wireframes/panel-unlock/pu-m0x-couldnt-unlock.html interface: | mintSealingKey(): { publicKey: string; fingerprint: string } # publicKey = Ed25519 VERKEY qb64 (rides ek=); seed held in bundle memory, one per page unlockFromSealedBox(req: { sealedPasscode: string; expectedAid: string }): Promise<void> # Decrypter({}, seedQb64b).decrypt(cipherQb64) -> Salter -> bran; connect; # assert agent AID == expectedAid, else discard + throw { kind: 'agent-mismatch' } seam: app/tests/unit (bundle verbs over fixed vectors, no container, no network) acceptance: - given: a cipher sealed to the minted key by signify's Encrypter when: unlockFromSealedBox runs then: the passcode is recovered, the client connects, isUnlocked() is true - given: the connected agent AID is not expectedAid when: the check runs then: the passcode is discarded, the seat stays locked, agent-mismatch is thrown - given: two mintSealingKey calls when: compared then: the second replaces the first and differs - given: a seal-then-open round trip over a fixed vector when: the bran is recovered then: it is byte-identical to the one sealed (pins the pad position) depends_on: [1934] out_of_scope: - the wallet's sealing side (matou-app#663) - the door's relay (idss#1933, landed) - any panel screen or state (idss#1934, landed) needs_human_decision: [] ``` --- *Filed by `/to-tickets` follow-up on spec [#1929](https://git.matou.nz/Matou/idss/issues/1929) after #1934 closed with these verbs declared but unimplemented; Ben confirmed filing and the #1936 edge 2026-09-27.* 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015es4bpK4qRqZhrRYQBWCiY
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=34408
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=34408 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1938 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1938,
  "status": "success",
  "commits": [
    "37125b733deed2f3edac36f6aca1e958ac034082"
  ],
  "changed_files": [
    "STATUS.md",
    "app/src/keriweb/main.ts",
    "app/src/lib/keri/index.ts",
    "app/src/lib/keri/sealedPasscode.ts",
    "app/src/lib/sessionUnlock.ts",
    "app/tests/unit/keriwebStewardMount.test.ts",
    "app/tests/unit/sealedPasscode.test.ts",
    "dashboard/src/lib/handoverPort.ts",
    "dashboard/src/lib/idip.ts",
    "docs/adr/0282-the-app-sign-in-hands-the-control-panel-the-stewards-passcode.md"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/unit/sealedPasscode.test.ts tests/unit/keriwebStewardMount.test.ts tests/unit/sessionUnlock.test.ts (app)",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json (app)",
      "exit_code": 0
    },
    {
      "command": "npx vite build -c vite.keriweb.config.ts (app keriweb bundle)",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json (dashboard)",
      "exit_code": 0
    },
    {
      "command": "npx vitest run tests/unit/signingSession.test.ts tests/unit/idipRosterPanel.test.ts tests/unit/removeMember.test.ts (dashboard)",
      "exit_code": 0
    },
    {
      "command": "npx eslint . (repo root)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "both verbs exist on window.idssKeriSteward through the production loader — no undefined at runtime": "app/src/keriweb/main.ts mounts mintSealingKey/unlockFromSealedBox on window.idssKeriSteward + the Window interface; proven by tests/unit/keriwebStewardMount.test.ts (imports the bundle, asserts both are functions)",
    "mintSealingKey returns an Ed25519 verkey qb64 as publicKey plus a short fingerprint, seed in memory only": "app/src/lib/keri/sealedPasscode.ts PageSealingKey.mint; tests/unit/sealedPasscode.test.ts 'mints an Ed25519 verkey qb64...' (Verfer code === Ed25519, fingerprint xxxx·xxxx, handle carries no bran)",
    "two mintSealingKey calls: the second replaces the first and returns a different key": "tests/unit/sealedPasscode.test.ts 'holds at most one key...'",
    "a cipher sealed to the minted key opens, connects, isUnlocked() true": "openSealedPasscode → openBran + connect + hold; tests/unit/sealedPasscode.test.ts 'recovers the passcode, connects, and holds it...' (hold called with recovered bran)",
    "agent AID not expectedAid: discarded, seat stays locked, agent-mismatch thrown, no retry/continue": "openSealedPasscode throws AgentMismatch (kind agent-mismatch) before hold; tests/unit/sealedPasscode.test.ts 'fails closed on an agent mismatch...' (hold NOT called)",
    "malformed/truncated/wrongly-keyed cipher throws, seat stays locked, distinguishable from mismatch": "openBran throws a plain Error (no kind); tests/unit/sealedPasscode.test.ts 'a malformed / wrongly-keyed cipher throws... distinguishable' (not instanceof AgentMismatch, connect never called, hold not called)",
    "nothing written to localStorage/sessionStorage/IndexedDB/log; no plaintext passcode in a thrown message": "seed held in a private field, KERIClient uses memoryStore(), sessionUnlock keeps bran in memory only; error messages carry no passcode — tests assert String(err) does not contain the golden bran",
    "await ready() not run: the verb initialises libsodium first rather than throwing": "PageSealingKey.openBran and the bundle both await ready() (Decrypter requires it); the bundle pre-warms ready() at load so the synchronous mint is safe — app/src/keriweb/main.ts",
    "round-trip golden pins the pad position: recovered bran byte-identical to sealed": "saltQb64FromBran ('0A'+'A'+bran) / branFromSaltQb64 (substring(3)); tests/unit/sealedPasscode.test.ts 'a bran sealed by the wallet opens byte-identical — NOT the substring(2,23) trim'",
    "stale wording in idip.ts, handoverPort.ts and ADR 0282 d.6 corrected; STATUS.md updated in the same commit": "dashboard/src/lib/idip.ts + handoverPort.ts (Ed25519 verkey / CESR qb64 cipher, not X25519 keypair / libsodium sealed box); docs/adr/0282-*.md d.6 + amendment; STATUS.md milestone entry — all in commit 37125b73"
  },
  "summary": "Implemented the steward bundle's mintSealingKey/unlockFromSealedBox (Ed25519 sealing key, signify Encrypter/Decrypter, agent-identity check failing closed), pinned the pad position with a round-trip golden, and corrected the stale X25519/libsodium wording.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1938 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1938, "status": "success", "commits": [ "37125b733deed2f3edac36f6aca1e958ac034082" ], "changed_files": [ "STATUS.md", "app/src/keriweb/main.ts", "app/src/lib/keri/index.ts", "app/src/lib/keri/sealedPasscode.ts", "app/src/lib/sessionUnlock.ts", "app/tests/unit/keriwebStewardMount.test.ts", "app/tests/unit/sealedPasscode.test.ts", "dashboard/src/lib/handoverPort.ts", "dashboard/src/lib/idip.ts", "docs/adr/0282-the-app-sign-in-hands-the-control-panel-the-stewards-passcode.md" ], "tests": [ { "command": "npx vitest run tests/unit/sealedPasscode.test.ts tests/unit/keriwebStewardMount.test.ts tests/unit/sessionUnlock.test.ts (app)", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json (app)", "exit_code": 0 }, { "command": "npx vite build -c vite.keriweb.config.ts (app keriweb bundle)", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json (dashboard)", "exit_code": 0 }, { "command": "npx vitest run tests/unit/signingSession.test.ts tests/unit/idipRosterPanel.test.ts tests/unit/removeMember.test.ts (dashboard)", "exit_code": 0 }, { "command": "npx eslint . (repo root)", "exit_code": 0 } ], "criteria": { "both verbs exist on window.idssKeriSteward through the production loader — no undefined at runtime": "app/src/keriweb/main.ts mounts mintSealingKey/unlockFromSealedBox on window.idssKeriSteward + the Window interface; proven by tests/unit/keriwebStewardMount.test.ts (imports the bundle, asserts both are functions)", "mintSealingKey returns an Ed25519 verkey qb64 as publicKey plus a short fingerprint, seed in memory only": "app/src/lib/keri/sealedPasscode.ts PageSealingKey.mint; tests/unit/sealedPasscode.test.ts 'mints an Ed25519 verkey qb64...' (Verfer code === Ed25519, fingerprint xxxx·xxxx, handle carries no bran)", "two mintSealingKey calls: the second replaces the first and returns a different key": "tests/unit/sealedPasscode.test.ts 'holds at most one key...'", "a cipher sealed to the minted key opens, connects, isUnlocked() true": "openSealedPasscode → openBran + connect + hold; tests/unit/sealedPasscode.test.ts 'recovers the passcode, connects, and holds it...' (hold called with recovered bran)", "agent AID not expectedAid: discarded, seat stays locked, agent-mismatch thrown, no retry/continue": "openSealedPasscode throws AgentMismatch (kind agent-mismatch) before hold; tests/unit/sealedPasscode.test.ts 'fails closed on an agent mismatch...' (hold NOT called)", "malformed/truncated/wrongly-keyed cipher throws, seat stays locked, distinguishable from mismatch": "openBran throws a plain Error (no kind); tests/unit/sealedPasscode.test.ts 'a malformed / wrongly-keyed cipher throws... distinguishable' (not instanceof AgentMismatch, connect never called, hold not called)", "nothing written to localStorage/sessionStorage/IndexedDB/log; no plaintext passcode in a thrown message": "seed held in a private field, KERIClient uses memoryStore(), sessionUnlock keeps bran in memory only; error messages carry no passcode — tests assert String(err) does not contain the golden bran", "await ready() not run: the verb initialises libsodium first rather than throwing": "PageSealingKey.openBran and the bundle both await ready() (Decrypter requires it); the bundle pre-warms ready() at load so the synchronous mint is safe — app/src/keriweb/main.ts", "round-trip golden pins the pad position: recovered bran byte-identical to sealed": "saltQb64FromBran ('0A'+'A'+bran) / branFromSaltQb64 (substring(3)); tests/unit/sealedPasscode.test.ts 'a bran sealed by the wallet opens byte-identical — NOT the substring(2,23) trim'", "stale wording in idip.ts, handoverPort.ts and ADR 0282 d.6 corrected; STATUS.md updated in the same commit": "dashboard/src/lib/idip.ts + handoverPort.ts (Ed25519 verkey / CESR qb64 cipher, not X25519 keypair / libsodium sealed box); docs/adr/0282-*.md d.6 + amendment; STATUS.md milestone entry — all in commit 37125b73" }, "summary": "Implemented the steward bundle's mintSealingKey/unlockFromSealedBox (Ed25519 sealing key, signify Encrypter/Decrypter, agent-identity check failing closed), pinned the pad position with a round-trip golden, and corrected the stale X25519/libsodium wording.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1938
No description provided.