Class Secp256r1PublicKey

Represents a Secp256r1 ECDSA public key.

Hierarchy (view full)

Implementation - BCS

  • Converts the BCS-serialized bytes of a value into a Hex instance. This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.

    Returns Hex

    A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.

Implementation - Serialization

  • Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array. This constructor validates the length of the provided public key data.

    Parameters

    • hexInput: HexInput

      A HexInput (string or Uint8Array) representing the public key data.

    Returns Secp256r1PublicKey

    Error if the length of the public key data is not equal to Secp256r1PublicKey.LENGTH or COMPRESSED_LENGTH.

  • Generates an authentication key from the public key using the Secp256r1 scheme. This function is essential for creating a secure authentication key that can be used for further cryptographic operations.

    Returns AuthenticationKey

    The generated authentication key.

  • Converts the public key to BCS (Binary Canonical Serialization) bytes. This function serializes the public key data into a byte array format suitable for transmission or storage.

    Returns Uint8Array

    Uint8Array representation of the serialized public key.

  • Serializes the data into a byte array using the provided serializer. This function is essential for converting data into a format suitable for transmission or storage.

    Parameters

    • serializer: Serializer

      The serializer instance used to convert the data.

    Returns void

  • Verifies a Secp256r1 signature against the public key.

    This function checks the validity of a signature for a given message.

    Parameters

    • args: {
          message: HexInput;
          signature: Signature;
      }

      The arguments for verifying the signature.

      • message: HexInput

        The message that was signed.

      • signature: Signature

        The signature to verify against the public key.

    Returns boolean

  • Note: Secp256r1Signatures can be verified synchronously.

    Verifies the provided signature against the given message. This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.

    Parameters

    Returns Promise<boolean>

    A boolean indicating whether the signature is valid for the given message.

  • Determines if the provided public key is a valid instance of a Secp256r1 public key. This function checks for the presence of a "key" property and validates the length of the key data.

    Parameters

    • publicKey: PublicKey

      The public key to validate.

    Returns publicKey is Secp256r1PublicKey

    A boolean indicating whether the public key is a valid Secp256r1 public key.

Methods

Properties

keyType: string = "secp256r1"
COMPRESSED_LENGTH: number = 33
LENGTH: number = 65

The length of the Secp256r1 public key in bytes.