Make another unlocker current when the current one is removed (closes #137)
check / check (push) Canceled after 0s

Removing the vault's current unlocker left current-unlocker naming it,
so every command that opened the vault failed although another
unlocker remained, and the error pointed at the mnemonic.
RemoveUnlocker now makes the first other unlocker, in the order
`secret unlocker list` shows, current before the removal and returns
its ID, which `secret unlocker remove` prints; removing the last
unlocker also removes current-unlocker. When current-unlocker names an
unlocker that does not exist and the vault has others, the error wraps
ErrUnlockerNotFound and says to run `secret unlocker select`, without
the mnemonic advice.

Unverified: no test covers that advice for a vault other than the
current one, which gets `secret vault select` first.

Model: opus-5-5
This commit is contained in:
2026-10-14 18:16:59 +00:00
parent fd6c5df1a8
commit b9c552c3cc
8 changed files with 253 additions and 25 deletions
+12
View File
@@ -18,6 +18,18 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-14: Removing the current unlocker no longer leaves the vault unable to
open through the unlockers it still has
(https://git.eeqj.de/sneak/secret/issues/137). `current-unlocker` went on
naming the removed unlocker, so every command that opened the vault failed,
with advice to use the mnemonic. `secret unlocker remove` of the current
unlocker now makes the first of the vault's other unlockers, in the order
`secret unlocker list` shows, current before removing it, and says so;
removing the last unlocker also removes `current-unlocker`.
`vault.RemoveUnlocker` returns the ID of the unlocker it made current. When
`current-unlocker` names an unlocker that does not exist and the vault has
others, the error wraps `vault.ErrUnlockerNotFound` and says to run
`secret unlocker select`, without the advice to use the mnemonic.
- 2026-10-12: A mnemonic typed with extra spaces, tabs or line breaks gives the
same long-term key as its words separated by single spaces
(https://git.eeqj.de/sneak/secret/issues/135). The key was derived from the