Two factors in the browser and on a phone; factors on one device never pair (v0.6.0) #8

Manually merged
mnovak merged 1 commits from feature/web-factors into main 2026-11-03 15:28:34 +01:00
Owner

Core for Custos phase 4 (the phone). Version 0.6.0.

What

  • custos-wasm: two factors in the browser.
    • factors: a vault's version and factor ids/types from the header.
    • recipient: a one-time key. Its secret half stays in WebAssembly memory and is used once.
    • open_with: any two factors. A factor is the password, a sealed answer (a TOTP release, a device's
      approval), or material the page holds (a passkey's PRF output).
    • match_code.
    • phone_enrol: the phone makes its approval key and seals it, with the PRF output, to the PC
      (pair:<id>). It keeps the key only wrapped with the PRF output.
    • phone_approve: unwraps the key with a fresh PRF output and seals it to a requester.
  • Vault::add_factor_apart, Error::SameDevice. Two factors kept on one device (a phone's passkey and
    its approval key, a PC's key and its approval key) never open the vault together. Each still pairs with
    every other factor. Found while designing the phone: without it, a phone's two factors alone would have
    opened the vault behind one Face ID.
  • custos_seal::sender_code: the match code of a box's ephemeral key. The receiver uses it to confirm
    who sealed the box.
  • Docs: FACTORS.md ("In the browser and on a phone", "Factors on one device never pair"), SEAL.md (the
    sender code), THREAT_MODEL.md (a paired phone's storage).

Tests (84, all pass)

  • custos-wasm, tests/factors.rs:
    • factor ids from the header;
    • opening with the password plus a sealed TOTP release: only the right context works, and a key works once;
    • one factor, or the same one twice, is refused;
    • pairing: the PC opens the enrolment only for its context, the sender code matches, and the material
      leaves only sealed or wrapped;
    • opening with the passkey;
    • the phone's two factors together are refused (SameDevice);
    • approve, and refuse with a wrong PRF.
  • custos-vault: factors added apart never open together, pair with everything else and with factors added
    later; unknown ids are refused.
  • custos-seal: the sender code is per box and needs a box.
  • wasm32: builds with the Custos flake's Nix toolchain.

Self-review

  • No new crypto: the existing seal, at-rest sealing and HKDF.
  • The PRF output passes through JavaScript (WebAuthn returns it there). It is a factor like the typed
    password, and both go straight into the module.
  • A malformed request never echoes its input. Errors are fixed sentences.
Core for Custos phase 4 (the phone). Version 0.6.0. ## What - **`custos-wasm`: two factors in the browser.** - `factors`: a vault's version and factor ids/types from the header. - `recipient`: a one-time key. Its secret half stays in WebAssembly memory and is used once. - `open_with`: any two factors. A factor is the password, a sealed answer (a TOTP release, a device's approval), or material the page holds (a passkey's PRF output). - `match_code`. - `phone_enrol`: the phone makes its approval key and seals it, with the PRF output, to the PC (`pair:<id>`). It keeps the key only wrapped with the PRF output. - `phone_approve`: unwraps the key with a fresh PRF output and seals it to a requester. - **`Vault::add_factor_apart`, `Error::SameDevice`.** Two factors kept on one device (a phone's passkey and its approval key, a PC's key and its approval key) never open the vault together. Each still pairs with every other factor. Found while designing the phone: without it, a phone's two factors alone would have opened the vault behind one Face ID. - **`custos_seal::sender_code`**: the match code of a box's ephemeral key. The receiver uses it to confirm who sealed the box. - **Docs:** FACTORS.md ("In the browser and on a phone", "Factors on one device never pair"), SEAL.md (the sender code), THREAT_MODEL.md (a paired phone's storage). ## Tests (84, all pass) - **custos-wasm, `tests/factors.rs`:** - factor ids from the header; - opening with the password plus a sealed TOTP release: only the right context works, and a key works once; - one factor, or the same one twice, is refused; - pairing: the PC opens the enrolment only for its context, the sender code matches, and the material leaves only sealed or wrapped; - opening with the passkey; - the phone's two factors together are refused (`SameDevice`); - approve, and refuse with a wrong PRF. - **custos-vault:** factors added apart never open together, pair with everything else and with factors added later; unknown ids are refused. - **custos-seal:** the sender code is per box and needs a box. - **wasm32:** builds with the Custos flake's Nix toolchain. ## Self-review - **No new crypto:** the existing seal, at-rest sealing and HKDF. - **The PRF output passes through JavaScript** (WebAuthn returns it there). It is a factor like the typed password, and both go straight into the module. - **A malformed request never echoes its input.** Errors are fixed sentences.
mnovak added 1 commit 2026-11-03 12:21:16 +01:00
mnovak manually merged commit 6e4da02351 into main 2026-11-03 15:28:34 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/CustosPublic#8