[wasm] Two factors in the browser: open_with (sealed answers, passkey PRF), phone pairing and approvals; factors added apart never pair; sender code; v0.6.0
This commit is contained in:
@@ -95,6 +95,29 @@ slot, then the body.
|
||||
because ids and types are not secret. The app uses them to ask the TOTP service or a paired device for a
|
||||
factor. Those services pass material through a mailbox they cannot read; see `docs/SEAL.md`.
|
||||
|
||||
## In the browser and on a phone
|
||||
|
||||
`custos-wasm` opens a version-2 vault with any two factors (`open_with`). A factor that comes from the
|
||||
factor service or from another device arrives as a box sealed to a one-time key the module made
|
||||
(`recipient`); the key's secret half never leaves WebAssembly memory and is used once.
|
||||
|
||||
**Pairing a phone** gives the vault two factors at once, both added by the PC (which writes the file):
|
||||
1. The PC waits with a one-time key and shows its match code; the phone shows the same code.
|
||||
2. On the phone, a passkey is created and evaluated with the WebAuthn PRF extension
|
||||
(salt `SHA-256("custos passkey v1")`). Its 32-byte output is the **passkey** factor's material.
|
||||
3. `phone_enrol` makes 32 random bytes, the phone's **approval** material, and seals both to the PC
|
||||
(context `pair:<pairing id>`). The phone keeps the approval material only wrapped with the PRF output
|
||||
(at-rest sealing, context `custos phone approval v1`), so stolen browser storage is not a factor.
|
||||
4. The phone shows the box's sender code (`docs/SEAL.md`); the PC adds the factors only after you confirm it
|
||||
shows the same code. It adds the approval factor **apart** from the passkey (`add_factor_apart`).
|
||||
|
||||
**Factors on one device never pair.** `add_factor_apart` writes no pair slot between the new factor and the
|
||||
ones named, so those two open nothing together (`Error::SameDevice`) while each still pairs with every other
|
||||
factor. A phone's passkey and its approval key, or a PC's device key and its approval key, are added apart.
|
||||
|
||||
`phone_approve` unwraps the approval material with a fresh PRF output (Face ID, Touch ID) and seals it to a
|
||||
requesting device, for `approval:<factor id>:<request id>`. The material exists unwrapped only inside that call.
|
||||
|
||||
## Body
|
||||
|
||||
`"format": 2`, and a `factors` list next to `items`:
|
||||
|
||||
@@ -36,6 +36,12 @@ approval to the key the box is sealed for.
|
||||
|
||||
Test vector: R = `07` × 32 → `684361`.
|
||||
|
||||
### The sender code
|
||||
|
||||
The match code of a box's ephemeral key E (`sender_code`). When the receiver must know who sealed a box,
|
||||
as when a PC adds a phone's factors, the sealing screen shows this code and the receiving screen asks the
|
||||
person to confirm it. E is fresh for every box, so each box has its own code.
|
||||
|
||||
## At rest
|
||||
|
||||
The factor service keeps each TOTP share sealed with its own key, which comes from a systemd credential
|
||||
|
||||
@@ -61,6 +61,10 @@ just as plainly, what it does not.
|
||||
- **The factor service holds one factor.** It releases the TOTP factor after a valid code, so whoever
|
||||
controls the home server has that factor. It is one factor, never enough alone. Approval material and
|
||||
cloud secrets pass through it only as sealed boxes (`docs/SEAL.md`), which it cannot open.
|
||||
- **A paired phone's browser storage** holds its approval material wrapped with the passkey's PRF output,
|
||||
which the authenticator gives only after Face ID or Touch ID. The passkey and the approval key are added
|
||||
apart (docs/FACTORS.md), so the phone alone is one device and opens nothing: it still needs the master
|
||||
password, the TOTP code or a PC.
|
||||
- **An approval is only as careful as the person approving.** Compare the six-digit match code on both
|
||||
screens; a request you did not start is someone else's.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user