Leave a vault from the app and the extension, also one a sync problem names (#1003) #29
Loading…
Reference in a new issue
No description provided.
Delete branch "board/1003-da9661"
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?
Stacked on #18 (#979, branch
board/979-ebe940), which addsPOST /v1/vaults/{id}/leave,Session::leave_vaultand the sync problems that name a vault you pay for. Merge #18 first. This PR then targetsmain: Forgejo retargets it when #18's branch is deleted, or retarget it by hand.Board: #1003
What changes
Client (
client/src/lib.rs)Session::problemsis nowVec<Problem { text, leave: Option<Hex> }>.Problemderefs to and displays as its text, so the CLI is unchanged.leave, at the three places it writes aplaintext vault leavehint. The front ends never parse text, so a server's error text with a planted hint can't put Leave on a different vault.leaveis set only whenleavable(id)holds. That needs!is_own(id)and, when this device has no verified roster for the vault, no device of yours ever verified it (keyring.rosters). A fresh device can't tell which of those vaults you created, and a server can hide one to get it offered. An agent's vault keeps its Leave.ponytail:comment, and #998's CLI hint has the same one.create_vaultrecords the new vault's checkpoint in the keyring right away (best effort), so that window doesn't wait for the next sync.is_ownis copied verbatim from #998 (PR 26). Whichever PR merges second keeps a single copy. The hint wording for your own vaults stays #998's job.leaves_ownerless_asyncandleave_vault_asynclet the browser call them. The blocking versions wrap them.FFI (
ffi/src/lib.rs)leave_check(account, vault)returns three things: the vault's name (none for a vault the device can't open), whether you're its only owner while others still use it, and whether it has unsent changes.leave_vault(account, vault)is signed with the identity key, and also works by id for a vault the device can't open. It drops that vault's problems.AccountInfo.problem_vaultslines up withproblemsand comes fromProblem::leave.Apple app
Browser extension
syncreturns{text, leave}. The newAccount.leaveCheck(vault)andAccount.leaveVault(vault)take and put back the session.{text, key, vault};leaveCheckandleaveactions save the account's copy and lock it onsigned_out;Tests
client/src/tests.rscovers own vaults:leaveis set on the vaults sync names for leaving;ffi/src/tests.rsleaving_a_vault:wasm/src/extension/tests.rsleaving_a_vault_a_problem_namescovers the extension's check, leave and JSON shape.cargo clippy --locked --all-targets -- -D warningsandcargo test --lockedpass;cargo check -p plaintext-wasm --target wasm32-unknown-unknownpasses;PlaintextTestspass (6/6).🤖 Generated with Claude Code
App: leave a vault, also one a sync problem names (#1003)to Leave a vault from the app and the extension, also one a sync problem names (#1003)24c59d8, already merged here)