pub struct SecretKey { /* private fields */ }
Implementations
sourceimpl SecretKey
impl SecretKey
pub const SIZE: usize
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
pub fn is_3rd_highest_bit_clear(&self) -> bool
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.
pub fn chain(&self) -> &ChainCode
sourcepub fn key(&self) -> &SecretKey
pub fn key(&self) -> &SecretKey
Access the actual secret key to do key exchange or signing
HD Secret keys are composed of both an extended secret key and a chain code. This function gives access to the secret key without the chaincode
pub fn into_key(self) -> SecretKey
sourcepub fn exchange<P>(&self, public_key: &P) -> SharedSecret where
P: AsRef<PublicKey>,
pub fn exchange<P>(&self, public_key: &P) -> SharedSecret where
P: AsRef<PublicKey>,
generate a shared secret between the owner of the given public key and ourselves.
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.
pub fn derive<P>(&self, path: P) -> SecretKey where
P: AsRef<[u8]>,
Trait Implementations
impl Eq for SecretKey
impl StructuralEq for SecretKey
impl StructuralPartialEq 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