Struct diem_sdk::types::transaction::authenticator::AuthenticationKey
pub struct AuthenticationKey(_);
Expand description
A struct that represents an account authentication key. An account’s address is the last 16 bytes of authentication key used to create it
Implementations§
§impl AuthenticationKey
impl AuthenticationKey
pub const fn new(bytes: [u8; 32]) -> AuthenticationKey
pub const fn new(bytes: [u8; 32]) -> AuthenticationKey
Create an authentication key from bytes
pub const fn zero() -> AuthenticationKey
pub const fn zero() -> AuthenticationKey
Return an authentication key that is impossible (in expectation) to sign for–useful for intentionally relinquishing control of an account.
pub fn from_preimage(preimage: &AuthenticationKeyPreimage) -> AuthenticationKey
pub fn from_preimage(preimage: &AuthenticationKeyPreimage) -> AuthenticationKey
Create an authentication key from a preimage by taking its sha3 hash
pub fn ed25519(public_key: &Ed25519PublicKey) -> AuthenticationKey
pub fn ed25519(public_key: &Ed25519PublicKey) -> AuthenticationKey
Create an authentication key from an Ed25519 public key
pub fn multi_ed25519(public_key: &MultiEd25519PublicKey) -> AuthenticationKey
pub fn multi_ed25519(public_key: &MultiEd25519PublicKey) -> AuthenticationKey
Create an authentication key from a MultiEd25519 public key
pub fn derived_address(&self) -> AccountAddress
pub fn derived_address(&self) -> AccountAddress
Return an address derived from the last AccountAddress::LENGTH
bytes of this
authentication key.
pub fn prefix(&self) -> [u8; 16]
pub fn prefix(&self) -> [u8; 16]
Return the first AccountAddress::LENGTH bytes of this authentication key
pub fn random() -> AuthenticationKey
pub fn random() -> AuthenticationKey
Create a random authentication key. For testing only
Trait Implementations§
§impl Arbitrary for AuthenticationKey
impl Arbitrary for AuthenticationKey
§type Parameters = <[u8; 32] as Arbitrary>::Parameters
type Parameters = <[u8; 32] as Arbitrary>::Parameters
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<<[u8; 32] as Arbitrary>::Strategy, fn(_: [u8; 32]) -> AuthenticationKey>
type Strategy = Map<<[u8; 32] as Arbitrary>::Strategy, fn(_: [u8; 32]) -> AuthenticationKey>
The type of
Strategy
used to generate values of type Self
.§fn arbitrary_with(
_top: <AuthenticationKey as Arbitrary>::Parameters
) -> <AuthenticationKey as Arbitrary>::Strategy
fn arbitrary_with( _top: <AuthenticationKey as Arbitrary>::Parameters ) -> <AuthenticationKey as Arbitrary>::Strategy
§impl AsRef<[u8]> for AuthenticationKey
impl AsRef<[u8]> for AuthenticationKey
§impl Clone for AuthenticationKey
impl Clone for AuthenticationKey
§fn clone(&self) -> AuthenticationKey
fn clone(&self) -> AuthenticationKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for AuthenticationKey
impl Debug for AuthenticationKey
§impl<'de> Deserialize<'de> for AuthenticationKey
impl<'de> Deserialize<'de> for AuthenticationKey
§fn deserialize<D>(
deserializer: D
) -> Result<AuthenticationKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<AuthenticationKey, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for AuthenticationKey
impl Display for AuthenticationKey
§impl FromStr for AuthenticationKey
impl FromStr for AuthenticationKey
§impl Hash for AuthenticationKey
impl Hash for AuthenticationKey
§impl LowerHex for AuthenticationKey
impl LowerHex for AuthenticationKey
§impl Ord for AuthenticationKey
impl Ord for AuthenticationKey
§fn cmp(&self, other: &AuthenticationKey) -> Ordering
fn cmp(&self, other: &AuthenticationKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
§impl PartialEq<AuthenticationKey> for AuthenticationKey
impl PartialEq<AuthenticationKey> for AuthenticationKey
§fn eq(&self, other: &AuthenticationKey) -> bool
fn eq(&self, other: &AuthenticationKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd<AuthenticationKey> for AuthenticationKey
impl PartialOrd<AuthenticationKey> for AuthenticationKey
§fn partial_cmp(&self, other: &AuthenticationKey) -> Option<Ordering>
fn partial_cmp(&self, other: &AuthenticationKey) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Serialize for AuthenticationKey
impl Serialize for AuthenticationKey
§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl TryFrom<&[u8]> for AuthenticationKey
impl TryFrom<&[u8]> for AuthenticationKey
§type Error = CryptoMaterialError
type Error = CryptoMaterialError
The type returned in the event of a conversion error.
§fn try_from(bytes: &[u8]) -> Result<AuthenticationKey, CryptoMaterialError>
fn try_from(bytes: &[u8]) -> Result<AuthenticationKey, CryptoMaterialError>
Performs the conversion.
§impl TryFrom<Vec<u8, Global>> for AuthenticationKey
impl TryFrom<Vec<u8, Global>> for AuthenticationKey
§type Error = CryptoMaterialError
type Error = CryptoMaterialError
The type returned in the event of a conversion error.
§fn try_from(
bytes: Vec<u8, Global>
) -> Result<AuthenticationKey, CryptoMaterialError>
fn try_from( bytes: Vec<u8, Global> ) -> Result<AuthenticationKey, CryptoMaterialError>
Performs the conversion.
§impl ValidCryptoMaterial for AuthenticationKey
impl ValidCryptoMaterial for AuthenticationKey
impl Copy for AuthenticationKey
impl Eq for AuthenticationKey
impl StructuralEq for AuthenticationKey
impl StructuralPartialEq for AuthenticationKey
Auto Trait Implementations§
impl RefUnwindSafe for AuthenticationKey
impl Send for AuthenticationKey
impl Sync for AuthenticationKey
impl Unpin for AuthenticationKey
impl UnwindSafe for AuthenticationKey
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.
source§impl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)§impl<T> ValidCryptoMaterialStringExt for Twhere
T: ValidCryptoMaterial,
impl<T> ValidCryptoMaterialStringExt for Twhere T: ValidCryptoMaterial,
§fn from_encoded_string(encoded_str: &str) -> Result<Self, CryptoMaterialError>
fn from_encoded_string(encoded_str: &str) -> Result<Self, CryptoMaterialError>
When trying to convert from bytes, we simply decode the string into
bytes before checking if we can convert.
§fn to_encoded_string(&self) -> Result<String, Error>
fn to_encoded_string(&self) -> Result<String, Error>
A function to encode into hex-string after serializing.