[−][src]Struct schnorr::keys::XSecretKey
An Extended seceret key for use with Ristretto Schnorr signatures.
Methods
impl XSecretKey
[src]
pub fn to_bytes(&self) -> [u8; 64]
[src]
Convert this SecretKey
into an array of 64 bytes, corresponding to
an Ristrettp expanded secreyt key.
Returns
An array of 64 bytes. The first 32 bytes represent the "expanded" secret key, and the last 32 bytes represent the "domain-separation" "nonce".
Examples
use schnorr::*; let mut csprng = mohan::mohan_rand(); let mini_secret_key: SecretKey = SecretKey::generate(&mut csprng); let secret_key: XSecretKey = XSecretKey::from(&mini_secret_key); let secret_key_bytes: [u8; 64] = secret_key.to_bytes(); assert!(&secret_key_bytes[..] != &[0u8; 64][..]);
pub fn from_bytes(bytes: &[u8]) -> Result<XSecretKey, SchnorrError>
[src]
Construct an SecretKey
from a slice of bytes.
Returns
A Result
whose okay value is an EdDSA SecretKey
or whose
error value is an SignatureError
describing the error that occurred.
Examples
use schnorr::*; let mut csprng = mohan::mohan_rand(); let secret_key: SecretKey = SecretKey::generate(&mut csprng); let ex_secret_key: XSecretKey = XSecretKey::from(&secret_key); let bytes: [u8; 64] = ex_secret_key.to_bytes(); let secret_key_again = XSecretKey::from_bytes(&bytes) ?;
pub fn generate<R>(csprng: R) -> XSecretKey where
R: CryptoRng + Rng,
[src]
R: CryptoRng + Rng,
Generate an Extended SecretKey
directly,
pub fn to_public(&self) -> XPublicKey
[src]
Derive the XPublicKey
corresponding to this SecretKey
.
pub fn as_public(&self) -> &XPublicKey
[src]
Return Reference the XPublicKey
corresponding to this SecretKey
.
pub fn from_secret(secret: &SecretKey) -> XSecretKey
[src]
Derive the XSecretKey
from given SecretKey.
pub fn derive_intermediate_key(
&self,
customize: impl FnOnce(&mut Transcript)
) -> XSecretKey
[src]
&self,
customize: impl FnOnce(&mut Transcript)
) -> XSecretKey
Returns a intermediate child xprv. Users must provide customize, in order to separate sibling keys from one another through unique derivation paths.
pub fn derive_key(&self, customize: impl FnOnce(&mut Transcript)) -> SecretKey
[src]
Returns a leaf private key. Users must provide customize, in order to separate sibling keys from one another through unique derivation paths.
Trait Implementations
impl Clone for XSecretKey
[src]
fn clone(&self) -> XSecretKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl ConstantTimeEq for XSecretKey
[src]
impl Debug for XSecretKey
[src]
impl Default for XSecretKey
[src]
fn default() -> XSecretKey
[src]
impl Drop for XSecretKey
[src]
impl Eq for XSecretKey
[src]
impl<'_> From<&'_ SecretKey> for XSecretKey
[src]
fn from(msk: &SecretKey) -> XSecretKey
[src]
Construct an SecretKey
from a MiniSecretKey
.
Examples
use schnorr::*; let mini_secret_key: SecretKey = SecretKey::generate(&mut mohan::mohan_rand()); let secret_key: XSecretKey = XSecretKey::from(&mini_secret_key);
impl PartialEq<XSecretKey> for XSecretKey
[src]
impl Zeroize for XSecretKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for XSecretKey
impl Send for XSecretKey
impl Sync for XSecretKey
impl Unpin for XSecretKey
impl UnwindSafe for XSecretKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
fn cast(self) -> U
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> FromBits<T> for T
fn from_bits(t: T) -> T
impl<T> FromCast<T> for T
fn from_cast(t: T) -> T
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> IntoBits<U> for T where
U: FromBits<T>,
U: FromBits<T>,
fn into_bits(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,