mirror of
https://github.com/fiatjaf/nak.git
synced 2026-10-05 15:18:23 +00:00
key: honor --with-parity when public key comes from --sec/default key instead of silently ignoring it.
This commit is contained in:
@@ -59,10 +59,18 @@ var public = &cli.Command{
|
|||||||
Action: func(ctx context.Context, c *cli.Command) error {
|
Action: func(ctx context.Context, c *cli.Command) error {
|
||||||
args := c.Args().Slice()
|
args := c.Args().Slice()
|
||||||
if len(args) == 0 && !isPiped() {
|
if len(args) == 0 && !isPiped() {
|
||||||
kr, _, err := gatherKeyerFromArguments(ctx, c)
|
kr, sk, err := gatherKeyerFromArguments(ctx, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if c.Bool("with-parity") {
|
||||||
|
if sk == (nostr.SecretKey{}) {
|
||||||
|
return fmt.Errorf("--with-parity requires a plain secret key, not a bunker")
|
||||||
|
}
|
||||||
|
_, pk := btcec.PrivKeyFromBytes(sk[:])
|
||||||
|
stdout(hex.EncodeToString(pk.SerializeCompressed()))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
pk, err := kr.GetPublicKey(ctx)
|
pk, err := kr.GetPublicKey(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get public key: %w", err)
|
return fmt.Errorf("failed to get public key: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user