pub struct SecretKey(_);
Expand description
Ed25519 Secret Key
Mind it though, losing this key means losing control over your identity
Implementations
sourceimpl SecretKey
impl SecretKey
sourcepub fn new<Rng>(rng: Rng) -> SecretKey where
Rng: RngCore + CryptoRng,
pub fn new<Rng>(rng: Rng) -> SecretKey where
Rng: RngCore + CryptoRng,
generate a new SecretKey
with the given random number generator
sourcepub fn exchange(&self, public_key: &PublicKey) -> SharedSecret
pub fn exchange(&self, public_key: &PublicKey) -> SharedSecret
generate a shared secret between the owner of the given public key and ourselves.
sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
get the PublicKey
associated to this key
Unlike the SecretKey
, the PublicKey
can be safely
publicly shared. The key can then be used to verify any
Signature
generated with this SecretKey
and the original
message.
sourcepub fn sign<T>(&self, msg: T) -> Signature where
T: AsRef<[u8]>,
pub fn sign<T>(&self, msg: T) -> Signature where
T: AsRef<[u8]>,
create a Signature
for the given message with this SecretKey
.
The Signature
can then be verified against the associated PublicKey
and the original message.
sourcepub fn leak_as_ref(&self) -> &[u8; 32]
pub fn leak_as_ref(&self) -> &[u8; 32]
get a reference to the inner Seed bytes
Security Consideration
be mindful that leaking the content of the internal signing key may result in losing the ultimate control of the signing key
Trait Implementations
sourceimpl Debug for SecretKey
impl Debug for SecretKey
conveniently provide an incomplete implementation of Debug for the SecretKey.
sourceimpl Drop for SecretKey
impl Drop for SecretKey
custom implementation of Drop so we can have more certainty that the secret key raw data will be scrubbed (zeroed) before releasing the memory
impl Eq for SecretKey
Auto Trait Implementations
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more