@@ -109,8 +109,7 @@ func (k PublicKey) Verify(context Context, message, sig []byte) bool {
109109
110110// MarshalBinary encodes a public key into binary form.
111111func (k PublicKey ) MarshalBinary () (data []byte , err error ) {
112- data = append ([]byte {}, k [:]... )
113- return
112+ return append ([]byte {}, k [:]... ), nil
114113}
115114
116115// UnmarshalBinary decodes a binary marshaled public key.
@@ -265,8 +264,7 @@ func (r RawSignature) Equal(cmp RawSignature) bool {
265264
266265// MarshalBinary encodes a signature into binary form.
267266func (r RawSignature ) MarshalBinary () (data []byte , err error ) {
268- data = append ([]byte {}, r [:]... )
269- return
267+ return append ([]byte {}, r [:]... ), nil
270268}
271269
272270// UnmarshalBinary decodes a binary marshaled signature.
@@ -619,7 +617,7 @@ type SignedPublicKey struct {
619617}
620618
621619// Open first verifies the blob signature and then unmarshals the blob.
622- func (s * SignedPublicKey ) Open (context Context , pub * PublicKey ) error { // nolint: interfacer
620+ func (s * SignedPublicKey ) Open (context Context , pub * PublicKey ) error {
623621 return s .Signed .Open (context , pub )
624622}
625623
@@ -649,25 +647,29 @@ func VerifyManyToOne(context Context, message []byte, sigs []Signature) bool {
649647
650648// NewPublicKey creates a new public key from the given hex representation or
651649// panics.
652- func NewPublicKey (hex string ) (pk PublicKey ) {
650+ func NewPublicKey (hex string ) PublicKey {
651+ var pk PublicKey
653652 if err := pk .UnmarshalHex (hex ); err != nil {
654653 panic (err )
655654 }
656- return
655+ return pk
657656}
658657
659658// HashToPublicKey creates a public key via h2c from the given domain separator
660659// and message. The private key of the returned public key is unknown.
661- func HashToPublicKey (dst , message []byte ) ( pk PublicKey ) {
660+ func HashToPublicKey (dst , message []byte ) PublicKey {
662661 point , err := h2c .Edwards25519_XMD_SHA512_ELL2_RO (dst , message )
663662 if err != nil {
664663 panic (err )
665664 }
666665
667666 var aCompressed curve.CompressedEdwardsY
668667 aCompressed .SetEdwardsPoint (point )
668+
669+ var pk PublicKey
669670 copy (pk [:], aCompressed [:])
670- return
671+
672+ return pk
671673}
672674
673675// RegisterTestPublicKey registers a hardcoded test public key with the
0 commit comments