mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 16:19:07 -05:00
fix reading hex secret key from input.
This commit is contained in:
parent
0d46d48881
commit
bda18e035a
|
@ -147,12 +147,12 @@ func gatherSecretKeyFromArguments(c *cli.Context) (string, error) {
|
|||
if err != nil {
|
||||
return "", fmt.Errorf("failed to decrypt: %w", err)
|
||||
}
|
||||
} else if bsec, err := hex.DecodeString(strings.Repeat("0", 64-len(sec)) + sec); err == nil {
|
||||
sec = hex.EncodeToString(bsec)
|
||||
} else if prefix, hexvalue, err := nip19.Decode(sec); err != nil {
|
||||
return "", fmt.Errorf("invalid nsec: %w", err)
|
||||
} else if prefix == "nsec" {
|
||||
sec = hexvalue.(string)
|
||||
} else if bsec, err := hex.DecodeString(strings.Repeat("0", 64-len(sec)) + sec); err == nil {
|
||||
sec = hex.EncodeToString(bsec)
|
||||
}
|
||||
|
||||
if ok := nostr.IsValid32ByteHex(sec); !ok {
|
||||
|
|
Loading…
Reference in New Issue
Block a user