key: decrypt with the password as argument never read the ncryptsec from stdin, it was decrypting an empty string.

This commit is contained in:
Yasuhiro Matsumoto
2026-07-15 09:20:19 +09:00
parent f2638ab2de
commit 469c99fb51

4
key.go
View File

@@ -173,7 +173,8 @@ var decryptKey = &cli.Command{
}
} else {
password = c.Args().Get(0)
for ncryptsec := range getStdinLinesOrArgumentsFromSlice([]string{ncryptsec}) {
// the ncryptsec codes come from stdin
for ncryptsec := range getStdinLinesOrArgumentsFromSlice(nil) {
sk, err := nip49.Decrypt(ncryptsec, password)
if err != nil {
ctx = lineProcessingError(ctx, "failed to decrypt: %s", err)
@@ -181,6 +182,7 @@ var decryptKey = &cli.Command{
}
stdout(sk.Hex())
}
exitIfLineProcessingError(ctx)
return nil
}
default: