pub struct WebAuthnAccount { /* private fields */ }secp256r1 only.Expand description
A WebAuthn / Passkey-style account.
Wraps a Secp256r1PrivateKey but produces transaction signatures in
the on-chain AnySignature::WebAuthn format. See the module-level
docs for the precise wire format.
Implementations§
Source§impl WebAuthnAccount
impl WebAuthnAccount
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generates a new random WebAuthn account using the default
RP-ID and origin (see DEFAULT_WEBAUTHN_RP_ID /
DEFAULT_WEBAUTHN_ORIGIN).
Sourcepub fn from_private_key(private_key: Secp256r1PrivateKey) -> Self
pub fn from_private_key(private_key: Secp256r1PrivateKey) -> Self
Creates a WebAuthn account from an existing P-256 private key, using the default RP-ID and origin.
Sourcepub fn from_parts(
private_key: Secp256r1PrivateKey,
rp_id: &str,
origin: &str,
) -> Self
pub fn from_parts( private_key: Secp256r1PrivateKey, rp_id: &str, origin: &str, ) -> Self
Creates a WebAuthn account from a private key and explicit RP-ID / origin strings.
The on-chain verifier does not enforce particular values for these
fields, but if you are interoperating with a relying party that
records the rpIdHash / origin for off-chain auditing you may
wish to specify them.
Sourcepub fn from_private_key_bytes(bytes: &[u8]) -> AptosResult<Self>
pub fn from_private_key_bytes(bytes: &[u8]) -> AptosResult<Self>
Creates a WebAuthn account from private-key bytes.
§Errors
Returns an error if bytes is not a valid 32-byte P-256 scalar.
Sourcepub fn address(&self) -> AccountAddress
pub fn address(&self) -> AccountAddress
Returns the account address (the on-chain authentication key).
Sourcepub fn public_key(&self) -> &Secp256r1PublicKey
pub fn public_key(&self) -> &Secp256r1PublicKey
Returns the underlying P-256 public key.
Sourcepub fn private_key(&self) -> &Secp256r1PrivateKey
pub fn private_key(&self) -> &Secp256r1PrivateKey
Returns a reference to the underlying P-256 private key.
Trait Implementations§
Source§impl Account for WebAuthnAccount
impl Account for WebAuthnAccount
Source§fn address(&self) -> AccountAddress
fn address(&self) -> AccountAddress
Source§fn authentication_key(&self) -> AuthenticationKey
fn authentication_key(&self) -> AuthenticationKey
Source§fn sign(&self, message: &[u8]) -> AptosResult<Vec<u8>>
fn sign(&self, message: &[u8]) -> AptosResult<Vec<u8>>
Source§fn signature_scheme(&self) -> u8
fn signature_scheme(&self) -> u8
Source§impl Clone for WebAuthnAccount
impl Clone for WebAuthnAccount
Source§fn clone(&self) -> WebAuthnAccount
fn clone(&self) -> WebAuthnAccount
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more