Class MultiKeyAccount
- Namespace
- Aptos
- Assembly
- Aptos.dll
Represents a MultiKey signer used to sign transactions with the MultiKey authentication scheme.
This accounts to use a M of N signing scheme. M and N are specified in the MultiKey. It signs messages via the array of M number of Accounts that individually correspond to a public key in the MultiKey.
public class MultiKeyAccount : Account
- Inheritance
-
MultiKeyAccount
- Inherited Members
Constructors
MultiKeyAccount(MultiKey, List<Account>)
Initializes a new instance of the MultiKeyAccount class with a MultiKey and a list of signers.
The signers should correspond to public keys in the MultiKeyAccount's public key.
public MultiKeyAccount(MultiKey multiKey, List<Account> signers)
Parameters
multiKey
MultiKeyThe MultiKey to use for signing.
signers
List<Account>The signers to use for signing.
Exceptions
- ArgumentException
If the signers do not correspond to public keys in the MultiKeyAccount's public key.
Fields
SignerIndicies
The corresponding indicies of the signers in the MultiKeyAccount's public key.
Example: If the MultiKey has 3 public keys [0x1, 0x2, 0x3] and signers [0x1, 0x3],
then the signer indices would be [0, 2].
public readonly int[] SignerIndicies
Field Value
- int[]
Signers
The signers used to sign messages. These signers should correspond to public keys in the MultiKeyAccount's public key. The number of signers should be equal or greater than the number of public keys in the MultiKeyAccount's public key.
public readonly List<Account> Signers
Field Value
Properties
Address
Gets the address of the account.
public override AccountAddress Address { get; }
Property Value
SigningScheme
The MultiKeyAccount uses a MultiKey signing scheme.
public override SigningScheme SigningScheme { get; }
Property Value
VerifyingKey
Gets the MultiKeyPublicKey for the account.
public override IVerifyingKey VerifyingKey { get; }
Property Value
Methods
Sign(AnyRawTransaction)
Signs a transaction using the account's private key.
public override Signature Sign(AnyRawTransaction transaction)
Parameters
transaction
AnyRawTransactionThe transaction to sign.
Returns
- Signature
The signed transaction.
Sign(byte[])
Signs a message into a signature using the signer.
public override Signature Sign(byte[] message)
Parameters
message
byte[]The message to sign as a byte array.
Returns
- Signature
The signed message.
SignWithAuthenticator(AnyRawTransaction)
Signs a transaction using the account's private key.
public override AccountAuthenticator SignWithAuthenticator(AnyRawTransaction transaction)
Parameters
transaction
AnyRawTransactionThe transaction to sign.
Returns
- AccountAuthenticator
The signed transaction.
SignWithAuthenticator(byte[])
Signs a message and returns an authenticator with the signature.
public override AccountAuthenticator SignWithAuthenticator(byte[] message)
Parameters
message
byte[]The message to sign as a byte array.
Returns
- AccountAuthenticator
The authenticator containing the signature.
VerifySignature(byte[], MultiKeySignature)
Verifies a signature for a given message.
public bool VerifySignature(byte[] message, MultiKeySignature signature)
Parameters
message
byte[]The message that was signed.
signature
MultiKeySignatureThe signed message to verify.
Returns
- bool
True if the signature is valid; otherwise, false.
VerifySignature(string, MultiKeySignature)
Verifies a signature for a given message.
public bool VerifySignature(string message, MultiKeySignature signature)
Parameters
message
stringThe message that was signed.
signature
MultiKeySignatureThe signed message to verify.
Returns
- bool
True if the signature is valid; otherwise, false.