Refuse an existing vault before asking for the mnemonic (closes #151)
check / check (push) Canceled after 0s

`secret init` and `secret vault create` asked for the mnemonic and the
unlocker passphrase, and `secret init` printed "Initialized secrets
manager at", before refusing a vault that already exists. The check
`vault.CreateVault` made before writing is now `vault.CheckNewVaultName`,
which both commands call while holding the state directory lock, before
the first prompt; `CreateVault` still calls it. `secret init` prints the
"Initialized" line only once the vault is created, so
`TestMnemonicNotReadNamesOnlyMnemonic` no longer expects it.

Judgement call: the same check validates the name, so `secret vault
create` with an invalid name also fails before the prompts.

Model: opus-5-5
This commit is contained in:
2026-10-14 21:33:24 +00:00
parent 46c395e045
commit 469f5a0662
6 changed files with 102 additions and 29 deletions
+9
View File
@@ -18,6 +18,15 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-14: `secret init` and `secret vault create` refuse a vault that
already exists before asking for the mnemonic or the unlocker passphrase
(https://git.eeqj.de/sneak/secret/issues/151). They used to ask for both and
only then refuse, and `secret init` printed "Initialized secrets manager at"
before the refusal. The new `vault.CheckNewVaultName`, which
`vault.CreateVault` also calls, checks the name while the command holds the
state directory lock, before the first prompt; `secret init` prints that line
only once the vault is created. `secret vault create` with an invalid name
also fails before asking.
- 2026-10-14: The passphrase and mnemonic prompts ask on the controlling
terminal (`/dev/tty`) instead of stdin, so `echo v | secret add s1 --force`,
`cat file | secret encrypt key` and `cat file.age | secret decrypt key` ask