pub struct Secret(/* private fields */);
Expand description
A secret key used to perform key agreement using the counterparty’s public key.
Implementations§
Source§impl Secret
impl Secret
Sourcepub fn new_from_field(sk: Fr) -> Self
pub fn new_from_field(sk: Fr) -> Self
Use the supplied field element as the secret key directly.
§Warning
This function exists to allow custom key derivation; it’s the caller’s responsibility to ensure that the input was generated securely.
Sourcepub fn public(&self) -> Public
pub fn public(&self) -> Public
Derive a public key for this secret key, using the conventional
decaf377
generator.
Sourcepub fn diversified_public(&self, diversified_generator: &Element) -> Public
pub fn diversified_public(&self, diversified_generator: &Element) -> Public
Derive a diversified public key for this secret key, using the provided
diversified_generator
.
Since key agreement does not depend on the basepoint, only on the secret key and the public key, a single secret key can correspond to many different (unlinkable) public keys.
Sourcepub fn key_agreement_with(&self, other: &Public) -> Result<SharedSecret, Error>
pub fn key_agreement_with(&self, other: &Public) -> Result<SharedSecret, Error>
Perform key agreement with the provided public key.
Fails if the provided public key is invalid.
Trait Implementations§
impl Eq for Secret
impl StructuralPartialEq for Secret
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnwindSafe for Secret
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more