pub enum AccountAuthenticator {
Ed25519 {
public_key: Ed25519PublicKey,
signature: Ed25519Signature,
},
MultiEd25519 {
public_key: Vec<u8>,
signature: Vec<u8>,
},
SingleKey {
public_key: Vec<u8>,
signature: Vec<u8>,
},
MultiKey {
public_key: Vec<u8>,
signature: Vec<u8>,
},
NoAccountAuthenticator,
Keyless {
public_key: Vec<u8>,
signature: Vec<u8>,
},
}Expand description
An authenticator for a single account (not the full transaction).
The on-chain BCS schema for the SingleKey, MultiKey, and Keyless
variants wraps the public key and signature in typed Aptos-core structs
(SingleKeyAuthenticator, MultiKeyAuthenticator, KeylessSignature)
whose BCS encodings already begin with their own enum/struct tags.
Internally we still hold pre-encoded Vec<u8> (callers produce those via the
AnyPublicKey/AnySignature/MultiKeyPublicKey/MultiKeySignature helpers).
To match the on-chain wire format exactly we hand-roll the Serialize
implementation so those variants emit the inner bytes inline – without the
extra ULEB128 length prefix that the derive impl would add to a Vec<u8> field.
Variants§
Ed25519
Ed25519 authentication (variant 0).
Fields
public_key: Ed25519PublicKeyThe public key (32 bytes).
signature: Ed25519SignatureThe signature (64 bytes).
MultiEd25519
Multi-Ed25519 authentication (variant 1).
SingleKey
Single-key authentication (ed25519, secp256k1 and secp256r1) (variant 2).
Fields
MultiKey
Multi-key authentication (mixed signature types) (variant 3).
Fields
NoAccountAuthenticator
No account authenticator used for simulation only (variant 4).
Keyless
keyless only.Keyless (OIDC-based) authentication (variant 5). Uses ephemeral keys and ZK proofs for authentication.
Implementations§
Source§impl AccountAuthenticator
impl AccountAuthenticator
Sourcepub fn ed25519(public_key: Vec<u8>, signature: Vec<u8>) -> Self
pub fn ed25519(public_key: Vec<u8>, signature: Vec<u8>) -> Self
Creates an Ed25519 account authenticator.
Sourcepub fn single_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self
pub fn single_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self
Creates a single-key account authenticator.
Sourcepub fn multi_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self
pub fn multi_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self
Creates a multi-key account authenticator.
Sourcepub fn no_account_authenticator() -> Self
pub fn no_account_authenticator() -> Self
Creates a no account authenticator.
Sourcepub fn for_simulate_endpoint(self) -> Self
pub fn for_simulate_endpoint(self) -> Self
Rewrites this authenticator for the Aptos /transactions/simulate endpoint.
The fullnode rejects requests whose authenticators contain a cryptographically valid signature (HTTP 400: “Simulated transactions must not have a valid signature”). The SDK applies this transform automatically before simulate HTTP calls so callers do not need to hand-replace authenticators.
SingleKeyandKeylessbecomeAccountAuthenticator::NoAccountAuthenticator, matching the common workaround for unified-key accounts.Ed25519,MultiEd25519, andMultiKeykeep their public key material but replace signature bytes with zeros (preservingMultiEd25519/MultiKeyvector lengths).
Sourcepub fn keyless(public_key: Vec<u8>, signature: Vec<u8>) -> Self
Available on crate feature keyless only.
pub fn keyless(public_key: Vec<u8>, signature: Vec<u8>) -> Self
keyless only.Creates a keyless account authenticator.
§Arguments
public_key- The ephemeral public key bytessignature- The BCS-serializedKeylessSignature
Sourcepub fn verify(&self, message: &[u8]) -> AptosResult<()>
pub fn verify(&self, message: &[u8]) -> AptosResult<()>
Verifies the authenticator against a signing message.
§Errors
Returns an error if the authenticator does not verify for the message.
Sourcepub fn derived_address(&self) -> AptosResult<AccountAddress>
pub fn derived_address(&self) -> AptosResult<AccountAddress>
Returns the account address implied by this authenticator’s public key material.
§Errors
Returns an error if the contained public key bytes cannot be parsed.
Trait Implementations§
Source§impl Clone for AccountAuthenticator
impl Clone for AccountAuthenticator
Source§fn clone(&self) -> AccountAuthenticator
fn clone(&self) -> AccountAuthenticator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountAuthenticator
impl Debug for AccountAuthenticator
Source§impl<'de> Deserialize<'de> for AccountAuthenticator
impl<'de> Deserialize<'de> for AccountAuthenticator
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl From<Ed25519Authenticator> for AccountAuthenticator
impl From<Ed25519Authenticator> for AccountAuthenticator
Source§fn from(auth: Ed25519Authenticator) -> Self
fn from(auth: Ed25519Authenticator) -> Self
Source§impl PartialEq for AccountAuthenticator
impl PartialEq for AccountAuthenticator
Source§fn eq(&self, other: &AccountAuthenticator) -> bool
fn eq(&self, other: &AccountAuthenticator) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for AccountAuthenticator
impl Serialize for AccountAuthenticator
impl Eq for AccountAuthenticator
impl StructuralPartialEq for AccountAuthenticator
Auto Trait Implementations§
impl Freeze for AccountAuthenticator
impl RefUnwindSafe for AccountAuthenticator
impl Send for AccountAuthenticator
impl Sync for AccountAuthenticator
impl Unpin for AccountAuthenticator
impl UnsafeUnpin for AccountAuthenticator
impl UnwindSafe for AccountAuthenticator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.