CLI: failed keychain deletes are errors; key remove works out its session id locally (#1019) #39
Loading…
Reference in a new issue
No description provided.
Delete branch "board/1019-dada1d"
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?
Follow-up to #35 (board #1019).
Failed keychain deletes are errors now
state::forgetreturnsRes<()>. The server logout stays best effort, but a local copy (with its Account Key) that can't be deleted is an error.remove_accountpropagates the Secret Key delete.lock,account remove,key remove --allandpasswdno longer print success after a failed delete; each says what did happen and to runplaintext lockor try again.end_sessionsreturnsRes<bool>and no longer swallows its local delete.key removeworks out this terminal's session id locallyhex(sha256(token)[..8]), as the server computes it, so there's noGET /v1/sessions.unkeyandlock.unkeyruns only when the stored session is the removed key's, not whenever no keys remain.account remove's.The NITs from the ticket comment
end_sessionsuses the stored token only underresume()'s checks: unexpired, and from this terminal.key removealready falls back tostate::open(). The CLI unit tests get a#[cfg(test)] terminal(), since CI has no tty.key add: if unlocking this terminal fails after the key was saved, that's a warning, so running it again doesn't hit "already exists".addand renewal race gets aponytail:comment.Known and accepted (review nits)
account removefrom another terminal, or after 12 hours, no longer ends the keys' sessions. It warns with their ids instead, since there's no right account toopen()for.key remove NAMEwith a stored key session older than 12 hours: theopen()fallback forgets the expired copy. If that unlock then fails, the warning with the ids is all that's left.Tests
cargo test -p plaintext-cliand clippy with-D warningspass.forgetandremove_accountfail, keeping the account listed, when the session or Secret Key can't be deleted.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.