feat(desktop): #142 PR-C — device pairing UI (initiator + approver, KEY-16 signed) #149
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!149
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/desktop-pairing-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part 3 of 3 for #142 slice 1 — the original pairing-UI scope, now buildable on PR #147 (device identity) + PR #148 (master-key lifecycle). Stacked on #148; diff vs main includes #148 until it merges.
What it fixes: the silent second-device fork — a second desktop generated a DIFFERENT master key and could read nothing the first desktop encrypted. Pairing transfers the existing key from an unlocked, enrolled device.
Rust — PairingService (5 tests incl. a full real-ML-KEM-768 blob roundtrip):
init_pairinggenerates an EPHEMERAL ml-kem-768 wrapping keypair (in-process memory, zeroized), POSTs/api/keys/authorize/init, returns the pairing payload + key fingerprint.poll_pairing_completefinds the approver's wrap on GetWraps, decapsulates, and adopts the master key via the newMasterKeyService::import(persisted under this device's KEK).approve_pairingparses the payload, encapsulates the master key to the challenge's wrapping pubkey, signs the KEY-16 canonical payload (ssdid-wrap-v1|challenge:{id}|...) with the enrolled Ed25519 device key (PR-A), and POSTs approve.ml_kem_ct[1088] || AES-GCM(master key under shared secret), self-contained for decapsulation.UI — PairDeviceSection (Settings → Devices):
Tests: cargo test 25/25 src-tauri; vitest 1287 pass / 1 skip (4 new); typecheck clean; lint 0 errors (9 pre-existing warnings).
The original slice-1 scope, now buildable on PR-A identity + PR-B master-key lifecycle. Fixes the silent second-device fork: a second desktop used to generate a DIFFERENT master key and could read nothing the first desktop encrypted - pairing transfers the existing key. Rust - PairingService (5 tests incl. full real-ML-KEM blob roundtrip): - Initiator: init_pairing generates an EPHEMERAL ml-kem-768 wrapping keypair (held in process memory, zeroized), calls /api/keys/authorize/init, returns the pairing payload + key fingerprint. poll_pairing_complete finds the approver's wrap on GetWraps, decapsulates (blob = ml_kem_ct[1088] || AES-GCM(master_key under shared secret) - self-contained, opaque to the server), and adopts the master key via the new MasterKeyService::import. - Approver: approve_pairing parses the payload, encapsulates the master key to the challenge pubkey, packs the blob, signs the KEY-16 canonical payload (ssdid-wrap-v1|challenge:{id}|...) with the enrolled Ed25519 device key, posts approve. - Wire format: base64url(json{challenge_id, pairing_secret, kem_algorithm, wrapping_pub_key}) - QR-encoded on mobile, copy/paste on desktop. Fingerprint = hex(SHA-256(wrapping pubkey))[..16] shown on BOTH screens (F-M8 visual matching). UI - PairDeviceSection (Settings -> Devices): - Initiator: QR + copyable payload + fingerprint chip + countdown + waiting state (first poll immediate, then 4s - under the wrap-fetch limiter); paired/expired states; cancel. - Approver: paste dialog with inline payload validation, fingerprint preview via WebCrypto before approval, approve-with-spinner. - Mounted under the Devices list; copy per F-M8 ("Confirm this fingerprint on the approving device before approving"). cargo test 25/25; vitest 1287 pass / 1 skip (4 new); typecheck clean; lint 0 errors.