Represents a multi-key authentication scheme for accounts, allowing multiple public keys to be associated with a single account. This class enforces a minimum number of valid signatures required to authorize actions, ensuring enhanced security for multi-agent accounts.

The public keys of each individual agent can be any type of public key supported by Aptos. Since AIP-55, Aptos supports Legacy and Unified authentication keys.

Hierarchy (view full)

Constructors

  • Signature for a K-of-N multi-sig transaction. This constructor initializes a multi-signature transaction with the provided signatures and bitmap.

    Parameters

    • args: {
          publicKeys: PublicKey[];
          signaturesRequired: number;
      }

      An object containing the parameters for the multi-signature transaction.

      • publicKeys: PublicKey[]
      • signaturesRequired: number

    Returns MultiKey

    Error if the number of signatures exceeds the maximum supported, if the bitmap length is incorrect, or if the number of signatures does not match the bitmap.

Methods

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

  • Create a bitmap that holds the mapping from the original public keys to the signatures passed in

    Parameters

    • args: {
          bits: number[];
      }
      • bits: number[]

        array of the index mapping to the matching public keys

    Returns Uint8Array

    Uint8array bit map

  • Get the index of the provided public key.

    This function retrieves the index of a specified public key within the MultiKey. If the public key does not exist, it throws an error.

    Parameters

    • publicKey: PublicKey

      The public key to find the index for.

    Returns number

    The corresponding index of the public key, if it exists.

    Error - If the public key is not found in the MultiKey.

  • Serializes the object by writing its signatures and bitmap to the provided serializer. This allows the object to be converted into a format suitable for transmission or storage.

    Parameters

    • serializer: Serializer

      The serializer instance used to perform the serialization.

    Returns void

  • Deserializes a MultiKeySignature from the provided deserializer. This function retrieves the signatures and bitmap necessary for creating a MultiKeySignature object.

    Parameters

    • deserializer: Deserializer

      The deserializer instance used to read the serialized data.

    Returns MultiKey

Properties

publicKeys: AnyPublicKey[]

List of any public keys

signaturesRequired: number

The minimum number of valid signatures required, for the number of public keys specified