feat(desktop): share contract — id-based recipients, server request shape, dead-call sweep (#207) #212
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!212
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/desk-share-contract"
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?
PR-D1b of the #207 align-then-adorn campaign — stacked on #211 (base is the D1a branch; retarget to main when #211 merges).
create_share speaks the live POST /api/shares contract: {resource_id, resource_type, shared_with_id, permission, encrypted_key, kem_algorithm, expires_at}. Recipients are user ids from the tenant member roster (the server has no user-search endpoint — /users/search never existed). Recipient key material comes from GET /users/{id}/public-key (the intentionally cross-tenant endpoint; PublicKeys JSON bundle parsed client-side).
Grant-key encapsulation: folder shares re-encapsulate the folder KEK; file shares unwrap the row's DEK with the parent folder key and encapsulate the DEK itself — one file, no folder over-grant. The hybrid wrap travels as base64(JSON{kem_ciphertext, wrapped_kek}) inside the server's single opaque encrypted_key field (relayed verbatim to recipients; byte-exact round trip verified).
folder_keys module (new): folder-KEK resolution extracted from file_service — shared by both services instead of a drifting near-copy.
Dead-call sweep: search_recipients + /users/search removed; recovery trustee setup now fails honestly up front (it depended on the same ghost search — was always a 404 in waiting; revisited with dev-plan 2.5); tauriService getFileMetadata/searchRecipients/encryptFile/decryptFile/decapsulateFolderKey/getFolderEncryptionMetadata removed (two invoked commands were never even registered); three orphaned Rust crypto commands removed; memberStore now parses ListMembers' bare-array response (was a phantom {members} envelope) and stops doubling /api in the URL.
ShareDialog recipient picker: member roster (loadMembers on open, client-side filter, selection by user_id); Admin permission option removed (server accepts read/write only — offering it guaranteed a 400).
Review: dual-pass done. Pass 2 found five Importants, all fixed in this PR: the phantom member shape (adapter from display_name/created_at + Array.isArray guard), the /api URL doubling, Admin dead-end, RecipientPublicKeys over-strict parsing (signing keys now tolerated-missing), and the explicit resource_type validation.
Tests: cargo 68 green; vitest 1306 green (shareStore 30, memberStore 13 with the real server projection, ShareDialog 18, tauri 56); tsc clean.
Legacy share LIST surfaces (my-shares/received/accept/decline, old Share model) are the next slice (dev-plan 7.3) — their shape mismatch is untouched by design.
Related: #207, #158, #211.
a0ac80b3860ce37434240ce3743424b7cb3ecfadb7cb3ecfad63cf441da6