Struct chain_crypto::SecretKey

source ·
pub struct SecretKey<A: AsymmetricKey>(pub(crate) A::Secret);

Tuple Fields§

§0: A::Secret

Implementations§

source§

impl<A: KeyEvolvingAlgorithm> SecretKey<A>

source

pub fn evolve(key: &mut Self) -> EvolvingStatus

Evolve the secret key to the next period

source

pub fn get_period(key: &Self) -> u32

Get the period associated with the current instance of the key

source§

impl<A: AsymmetricKey> SecretKey<A>

source

pub fn generate<T: RngCore + CryptoRng>(rng: T) -> Self

source

pub fn to_public(&self) -> PublicKey<A::PubAlg>

source

pub fn from_binary(data: &[u8]) -> Result<Self, SecretKeyError>

source

pub fn leak_secret(self) -> A::Secret

source§

impl<A: SigningAlgorithm> SecretKey<A>where <A as AsymmetricKey>::PubAlg: VerificationAlgorithm,

source

pub fn sign<T: ?Sized + AsRef<[u8]>>( &self, object: &T ) -> Signature<T, A::PubAlg>

source

pub fn sign_slice<T: ?Sized>(&self, slice: &[u8]) -> Signature<T, A::PubAlg>

Trait Implementations§

source§

impl<A> Arbitrary for SecretKey<A>where A: AsymmetricKey + 'static, A::Secret: Send,

source§

fn arbitrary<G: Gen>(g: &mut G) -> Self

§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>, Global>

source§

impl<A: SecretKeySizeStatic> Bech32 for SecretKey<A>

source§

const BECH32_HRP: &'static str = A::SECRET_BECH32_HRP

The human-readable prefix that is used to represent the the object in the Bech32 format. On decoding, the HRP of the input string is checked against this value.
source§

const BYTES_LEN: usize = A::SECRET_KEY_SIZE

Length of the encoded binary data.
source§

fn try_from_bech32_str(bech32_str: &str) -> Result<Self, Error>

Decodes the object from its Bech32 string representation.
source§

fn to_bech32_str(&self) -> String

Produces a Bech32 string format representation of the object.
source§

impl<A: AsymmetricKey> Clone for SecretKey<A>

source§

fn clone(&self) -> Self

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<A> Debug for SecretKey<A>where A: AsymmetricKey,

source§

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

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

impl<A: AsymmetricKey> From<SecretKey<A>> for KeyPair<A>

source§

fn from(secret_key: SecretKey<A>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<A> RefUnwindSafe for SecretKey<A>where <A as AsymmetricKey>::Secret: RefUnwindSafe,

§

impl<A> Send for SecretKey<A>where <A as AsymmetricKey>::Secret: Send,

§

impl<A> Sync for SecretKey<A>where <A as AsymmetricKey>::Secret: Sync,

§

impl<A> Unpin for SecretKey<A>where <A as AsymmetricKey>::Secret: Unpin,

§

impl<A> UnwindSafe for SecretKey<A>where <A as AsymmetricKey>::Secret: UnwindSafe,

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

fn vzip(self) -> V