add encode note.

This commit is contained in:
fiatjaf 2023-10-10 11:28:17 -03:00
parent 455ec79e58
commit ada76f281a
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -187,6 +187,23 @@ var encode = &cli.Command{
}
},
},
{
Name: "note",
Usage: "generate note1 event codes (not recommended)",
Action: func(c *cli.Context) error {
target := c.Args().First()
if err := validate32BytesHex(target); err != nil {
return err
}
if npub, err := nip19.EncodeNote(target); err == nil {
fmt.Println(npub)
return nil
} else {
return err
}
},
},
},
}