Skip to content

Provide more utility methods for conversion between basic pubkey/secret key types #428

@sanket1729

Description

@sanket1729

Similar motivation for the first commit of #372

Add method KeyPair::public_key
Currently to get the XOnlyPublicKey from a KeyPair users must do
XOnlyPublicKey::from_keypair(&kp). While this does the job we can make
the lib more ergonomic by providing a method directly on KeyPair that
calls through to XOnlyPublicKey::from_keypair.

I think we should have more conversion methods

  • KeyPair:

    • secret_key() -> SecretKey
    • x_only_pub_key() -> XOnlyPublicKey
    • pub_key() -> PublicKey See(389abdd#r831616364)
  • SecretKey:

    • keypair() -> KeyPair
    • x_only_pub_key() -> XOnlyPublicKey
    • pub_key() -> PublicKey
  • XonlyPublicKey:

    • pub_key() -> PublicKey
  • PublicKey:

    • x_only_pub_key() -> (XonlyPublicKey, Parity)

I would like to call these methods pubkey instead of pub_key, but I think because of #372 (comment) it might be difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions