@did-btc1/key-pair
    Preparing search index...

    Class PublicKey

    Encapsulates a secp256k1 public key. Provides get methods for different formats (compressed, x-only, multibase). Provides helpers methods for comparison and serialization. PublicKey

    Implements

    Index

    Constructors

    • Creates an instance of PublicKey.

      Parameters

      • bytes: Bytes

        The public key byte array.

      Returns PublicKey

      if the byte length is not 32 (x-only) or 33 (compressed)

    Accessors

    Methods

    • Decodes the multibase string to the 34-byte corresponding public key (2 byte prefix + 32 byte public key). See IPublicKey Method for more details.

      Returns Bytes

      The decoded public key: prefix and public key bytes

    • Encodes compressed secp256k1 public key from bytes to BIP340 base58btc multibase format See IPublicKey Method for more details.

      Returns string

      The public key encoded in base-58-btc multibase format