nip11, nip13, nip46 changes from promenade port.

and verify pubkey validity when decoding it from an arbitrary json object.
This commit is contained in:
fiatjaf
2025-05-11 17:42:15 -03:00
parent f60fc08f8d
commit 4befaa0129
4 changed files with 27 additions and 35 deletions

View File

@@ -74,6 +74,9 @@ func (pk *PubKey) UnmarshalJSON(buf []byte) error {
return fmt.Errorf("must be a hex string of 64 characters")
}
_, err := hex.Decode(pk[:], buf[1:65])
if _, err := schnorr.ParsePubKey(pk[:]); err != nil {
return fmt.Errorf("pubkey is not valid %w", err)
}
return err
}