lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 4e698067708facd300f95d153b111176ea0783c6
parent faeff91d9ef3a61a9bf373979f6fd68c14c842e5
Author: Sean Enck <sean@ttypty.com>
Date:   Sun,  5 Feb 2023 19:39:09 -0500

confirm rekey

Diffstat:
Mcmd/main.go | 6++++--
Mscripts/check.go | 8++++++--
Mscripts/tests.expected.log | 2++
3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/cmd/main.go b/cmd/main.go @@ -116,8 +116,10 @@ func run() error { } switch command { case cli.ReKeyCommand: - if err := t.ReKey(); err != nil { - return wrapped("unable to rekey", err) + if confirm("proceed with rekey") { + if err := t.ReKey(); err != nil { + return wrapped("unable to rekey", err) + } } case cli.ListCommand, cli.FindCommand: opts := backend.QueryOptions{} diff --git a/scripts/check.go b/scripts/check.go @@ -11,6 +11,8 @@ import ( "time" ) +var yes = []string{"y"} + const ( testKey = "plaintextkey" ) @@ -41,7 +43,7 @@ func ls() { } func rm(k string) { - runCommand([]string{"rm", k}, []string{"y"}) + runCommand([]string{"rm", k}, yes) } func show(k string) { @@ -124,15 +126,17 @@ func main() { rm("keys/k2/*") fmt.Println() ls() + fmt.Println() reKeyStore := fmt.Sprintf("%s.rekey.kdbx", store) reKey := "rekey" os.Setenv("LOCKBOX_STORE_NEW", reKeyStore) os.Setenv("LOCKBOX_KEY_NEW", reKey) os.Setenv("LOCKBOX_KEYMODE_NEW", "plaintext") os.Setenv("LOCKBOX_KEYFILE_NEW", "") - runCommand([]string{"key"}, nil) + runCommand([]string{"key"}, yes) os.Setenv("LOCKBOX_STORE", reKeyStore) os.Setenv("LOCKBOX_KEYFILE", "") os.Setenv("LOCKBOX_KEY", reKey) + fmt.Println() ls() } diff --git a/scripts/tests.expected.log b/scripts/tests.expected.log @@ -116,4 +116,6 @@ post rm keys/k2/t2/one2 CALLED keys/k/one2 + +proceed with rekey? (y/N) keys/k/one2