Represents any public key supported by Aptos.

Since AIP-55 Aptos supports Legacy and Unified authentication keys.

Any unified authentication key is represented in the SDK as AnyPublicKey.

Hierarchy (view full)

Implementation - BCS

  • Serializes a Serializable value to its BCS representation. This function is the TypeScript SDK equivalent of bcs::to_bytes in Move.

    Returns Uint8Array

    the BCS representation of the Serializable instance as a byte buffer.

  • 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

  • Creates an instance of the signature class based on the provided signature type. This allows for the handling of different signature variants such as Ed25519, Secp256k1, and Keyless.

    Parameters

    • publicKey: PublicKey

      The publicKey object which determines the variant to be used.

    Returns AnyPublicKey

    Error if the provided signature type is unsupported.

publicKey: PublicKey

Reference to the inner public key

Index of the underlying enum variant

  • Determines if the current public key is an instance of Ed25519PublicKey.

    Returns boolean

    use publicKey instanceof Ed25519PublicKey instead.

  • Checks if the public key is an instance of Secp256k1PublicKey.

    Returns boolean

    use publicKey instanceof Secp256k1PublicKey instead.

  • Serializes the current object using the provided serializer. This function helps in converting the object into a format suitable for transmission or storage.

    Parameters

    • serializer: Serializer

      The serializer instance used to perform the serialization.

    Returns void

  • Get the signature in bytes (Uint8Array).

    This function is a warning that it will soon return the underlying signature bytes directly. Use AnySignature.bcsToBytes() instead.

    Returns Uint8Array

    Uint8Array representation of the signature.

  • 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

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

      The arguments for signature verification.

      • message: HexInput

        The message that was signed.

      • signature: AnySignature

        The signature to verify, which must be an instance of AnySignature.

    Returns boolean

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

  • 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

    • args: {
          aptosConfig: AptosConfig;
          message: HexInput;
          options?: {
              throwErrorWithReason?: boolean;
          };
          signature: Signature;
      }

      The arguments for signature verification.

      • aptosConfig: AptosConfig

        The configuration object for connecting to the Aptos network

      • message: HexInput

        The message that was signed.

      • Optionaloptions?: {
            throwErrorWithReason?: boolean;
        }
        • OptionalthrowErrorWithReason?: boolean
      • signature: Signature

        The signature to verify, which must be an instance of AnySignature.

    Returns Promise<boolean>

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

  • Deserializes an AnySignature from the provided deserializer. This function helps in reconstructing the AnySignature object from its serialized form, allowing for further processing or validation.

    Parameters

    • deserializer: Deserializer

      The deserializer instance used to read the serialized data.

    Returns AnyPublicKey

  • Determines if the provided publicKey is an instance of a valid PublicKey object.

    Parameters

    • publicKey: PublicKey

      The publicKey to be checked for validity.

    Returns publicKey is AnyPublicKey

    True if the signature is a valid instance; otherwise, false.

Methods