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§

source§

impl AuthenticationKey

source

pub const fn new(bytes: [u8; 32]) -> Self

Create an authentication key from bytes

source

pub const fn zero() -> Self

Return an authentication key that is impossible (in expectation) to sign for–useful for intentionally relinquishing control of an account.

source

pub const LENGTH: usize = 32usize

The number of bytes in an authentication key.

source

pub fn from_preimage(preimage: &AuthenticationKeyPreimage) -> AuthenticationKey

Create an authentication key from a preimage by taking its sha3 hash

source

pub fn ed25519(public_key: &Ed25519PublicKey) -> AuthenticationKey

Create an authentication key from an Ed25519 public key

source

pub fn multi_ed25519(public_key: &MultiEd25519PublicKey) -> Self

Create an authentication key from a MultiEd25519 public key

source

pub fn derived_address(&self) -> AccountAddress

Return an address derived from the last AccountAddress::LENGTH bytes of this authentication key.

source

pub fn prefix(&self) -> [u8; 16]

Return the first AccountAddress::LENGTH bytes of this authentication key

source

pub fn to_vec(&self) -> Vec<u8>

Construct a vector from this authentication key

source

pub fn random() -> Self

Create a random authentication key. For testing only

Trait Implementations§

source§

impl Arbitrary for AuthenticationKey

§

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>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

impl AsRef<[u8]> for AuthenticationKey

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for AuthenticationKey

source§

fn clone(&self) -> AuthenticationKey

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for AuthenticationKey

source§

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

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

impl<'de> Deserialize<'de> for AuthenticationKey

source§

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

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

impl Display for AuthenticationKey

source§

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

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

impl FromStr for AuthenticationKey

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl Hash for AuthenticationKey

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl LowerHex for AuthenticationKey

source§

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

Formats the value using the given formatter.
source§

impl Ord for AuthenticationKey

source§

fn cmp(&self, other: &AuthenticationKey) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<AuthenticationKey> for AuthenticationKey

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<AuthenticationKey> for AuthenticationKey

source§

fn partial_cmp(&self, other: &AuthenticationKey) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for AuthenticationKey

source§

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

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

impl TryFrom<&[u8]> for AuthenticationKey

§

type Error = CryptoMaterialError

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

fn try_from(bytes: &[u8]) -> Result<AuthenticationKey, CryptoMaterialError>

Performs the conversion.
source§

impl TryFrom<Vec<u8, Global>> for AuthenticationKey

§

type Error = CryptoMaterialError

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

fn try_from(bytes: Vec<u8>) -> Result<AuthenticationKey, CryptoMaterialError>

Performs the conversion.
source§

impl ValidCryptoMaterial for AuthenticationKey

source§

fn to_bytes(&self) -> Vec<u8>

Convert the valid crypto material to bytes.
source§

impl Copy for AuthenticationKey

source§

impl Eq for AuthenticationKey

source§

impl StructuralEq for AuthenticationKey

source§

impl StructuralPartialEq for AuthenticationKey

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Equivalent<K> for Qwhere 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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,

source§

fn test_only_hash(&self) -> HashValue

Generates a hash used only for tests.
source§

impl<T> ToHex for Twhere T: AsRef<[u8]>,

source§

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>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> ValidCryptoMaterialStringExt for Twhere T: ValidCryptoMaterial,

source§

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.
source§

fn to_encoded_string(&self) -> Result<String, Error>

A function to encode into hex-string after serializing.
source§

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