From 9f98a0aea36e6899bc0266cf24be6a56b94f78cb Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 12 Jun 2024 08:54:00 -0300 Subject: [PATCH] fix nak key encrypt reading from stdin. --- key.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/key.go b/key.go index a7814d9..fe2fbbd 100644 --- a/key.go +++ b/key.go @@ -72,20 +72,19 @@ var encrypt = &cli.Command{ }, }, Action: func(c *cli.Context) error { - var content string + keys := make([]string, 0, 1) var password string switch c.Args().Len() { case 1: - content = "" password = c.Args().Get(0) case 2: - content = c.Args().Get(0) + keys = append(keys, c.Args().Get(0)) password = c.Args().Get(1) } if password == "" { return fmt.Errorf("no password given") } - for sec := range getSecretKeysFromStdinLinesOrSlice(c, []string{content}) { + for sec := range getSecretKeysFromStdinLinesOrSlice(c, keys) { ncryptsec, err := nip49.Encrypt(sec, password, uint8(c.Int("logn")), 0x02) if err != nil { lineProcessingError(c, "failed to encrypt: %s", err)