aboutsummaryrefslogtreecommitdiff
path: root/cli_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-01-30 02:08:55 +0700
committerShulhan <ms@kilabit.info>2024-01-30 02:08:55 +0700
commit267821d95857ed51e2e5e23556884c383d94ca24 (patch)
tree7b13ed4a6eb1947c63f6dd5236dc2c23b662282e /cli_test.go
parent77ba620765a5682e05169be8b8740df925f612c8 (diff)
downloadgotp-267821d95857ed51e2e5e23556884c383d94ca24.tar.xz
cli: ask for passphrase when removing or renaming label
Even though rename does not read the encrypted secret, as long as the private key is in use, it should ask for passphrase. The remove operation allow only the one that know the private key can modify the issuer.
Diffstat (limited to 'cli_test.go')
-rw-r--r--cli_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cli_test.go b/cli_test.go
index 9b24196..2c57d58 100644
--- a/cli_test.go
+++ b/cli_test.go
@@ -415,6 +415,9 @@ func testGetWithPassphrase(t *testing.T, tdata *test.Data, cli *Cli) {
}
func testRemoveWithPassphrase(t *testing.T, tdata *test.Data, cli *Cli) {
+ var pass = string(tdata.Input[`gotp.pass`]) + "\r\n"
+ mockTermrw.BufRead.WriteString(pass)
+
var err = cli.Remove(`test-sha512`)
if err != nil {
t.Fatal(err)
@@ -427,6 +430,9 @@ func testRemoveWithPassphrase(t *testing.T, tdata *test.Data, cli *Cli) {
// The Rename method does not require private key.
func testRenameWithPassphrase(t *testing.T, tdata *test.Data, cli *Cli) {
+ var pass = string(tdata.Input[`gotp.pass`]) + "\r\n"
+ mockTermrw.BufRead.WriteString(pass)
+
var err = cli.Rename(`test-sha1`, `renamed-sha1`)
if err != nil {
t.Fatal(err)