Skip to main content

AccountAuthenticator

Enum AccountAuthenticator 

Source
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: Ed25519PublicKey

The public key (32 bytes).

§signature: Ed25519Signature

The signature (64 bytes).

§

MultiEd25519

Multi-Ed25519 authentication (variant 1).

Fields

§public_key: Vec<u8>

The public key.

§signature: Vec<u8>

The signature.

§

SingleKey

Single-key authentication (ed25519, secp256k1 and secp256r1) (variant 2).

Fields

§public_key: Vec<u8>

The public key (BCS-serialized AnyPublicKey).

§signature: Vec<u8>

The signature (BCS-serialized AnySignature).

§

MultiKey

Multi-key authentication (mixed signature types) (variant 3).

Fields

§public_key: Vec<u8>

The public key (BCS-serialized MultiKeyPublicKey).

§signature: Vec<u8>

The signature (BCS-serialized MultiKeySignature).

§

NoAccountAuthenticator

No account authenticator used for simulation only (variant 4).

§

Keyless

Available on crate feature keyless only.

Keyless (OIDC-based) authentication (variant 5). Uses ephemeral keys and ZK proofs for authentication.

Fields

§public_key: Vec<u8>

The ephemeral public key bytes.

§signature: Vec<u8>

The BCS-serialized KeylessSignature containing ephemeral signature and ZK proof.

Implementations§

Source§

impl AccountAuthenticator

Source

pub fn ed25519(public_key: Vec<u8>, signature: Vec<u8>) -> Self

Creates an Ed25519 account authenticator.

Source

pub fn single_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self

Creates a single-key account authenticator.

Source

pub fn multi_key(public_key: Vec<u8>, signature: Vec<u8>) -> Self

Creates a multi-key account authenticator.

Source

pub fn no_account_authenticator() -> Self

Creates a no account authenticator.

Source

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.

Source

pub fn keyless(public_key: Vec<u8>, signature: Vec<u8>) -> Self

Available on crate feature keyless only.

Creates a keyless account authenticator.

§Arguments
  • public_key - The ephemeral public key bytes
  • signature - The BCS-serialized KeylessSignature
Source

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.

Source

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

Source§

fn clone(&self) -> AccountAuthenticator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccountAuthenticator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AccountAuthenticator

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Ed25519Authenticator> for AccountAuthenticator

Source§

fn from(auth: Ed25519Authenticator) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AccountAuthenticator

Source§

fn eq(&self, other: &AccountAuthenticator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AccountAuthenticator

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AccountAuthenticator

Source§

impl StructuralPartialEq for AccountAuthenticator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMoveArg for T
where T: Serialize,

Source§

fn into_move_arg(self) -> Result<Vec<u8>, AptosError>

Converts this value into BCS-encoded bytes. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,