PublicKey representation that has type and bytes of the key.

Hierarchy

  • Enum
    • PublicKey

Constructors

  • Parameters

    • publicKey: {
          data: Uint8Array;
          keyType: KeyType;
      }

    Returns PublicKey

Properties

ed25519Key?: ED25519PublicKey
enum: string
secp256k1Key?: SECP256K1PublicKey

Accessors

  • get data(): Uint8Array
  • Returns Uint8Array

  • get keyPair(): ED25519PublicKey | SECP256K1PublicKey
  • Returns ED25519PublicKey | SECP256K1PublicKey

  • get keyType(): KeyType
  • Returns KeyType

Methods

  • Returns a string representation of the public key.

    Returns string

    The string representation of the public key.

  • Verifies a message signature using the public key.

    Parameters

    • message: Uint8Array

      The message to be verified.

    • signature: Uint8Array

      The signature to be verified.

    Returns boolean

    true if the signature is valid, otherwise false.

  • Creates a PublicKey instance from a string or an existing PublicKey instance.

    Parameters

    • value: string | PublicKey

      The string or PublicKey instance to create a PublicKey from.

    Returns PublicKey

    The PublicKey instance.

  • Creates a PublicKey instance from an encoded key string.

    Parameters

    • encodedKey: string

      The encoded key string.

    Returns PublicKey

    The PublicKey instance created from the encoded key string.