@aptos-labs/ts-sdk - v3.1.1
    Preparing search index...

    Class AnyPublicKey

    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 Summary)

    Index

    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

    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.

    • 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 }
        • 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

    Methods