Skip to content

Commit

Permalink
btcec: add deep copy method for public keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggie1984 committed Dec 10, 2024
1 parent 67b8efd commit 70d818e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions btcec/pubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func NewPublicKey(x, y *FieldVal) *PublicKey {
return secp.NewPublicKey(x, y)
}

// CopyPublicKey returns a deep copy of the public key.
func CopyPublicKey(p *PublicKey) *PublicKey {
pk := secp.JacobianPoint{}
p.AsJacobian(&pk)
return secp.NewPublicKey(&pk.X, &pk.Y)
}

// SerializedKey is a type for representing a public key in its compressed
// serialized form.
//
Expand Down

0 comments on commit 70d818e

Please sign in to comment.