[−][src]Struct hkd32::KeyMaterial
Cryptographic key material: 256-bit (32-byte) uniformly random bytestring generated either via a CSRNG or via hierarchical derivation.
This type provides the main key derivation functionality and is used to represent both input and output key material.
Methods
impl KeyMaterial
[src]
pub fn random() -> Self
[src]
Create random key material using the operating system CSRNG
pub fn from_bech32<S>(encoded: S) -> Result<(String, Self), Error> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Decode key material from a Bech32 representation
pub fn from_mnemonic<S>(phrase: S, language: Language) -> Result<Self, Error> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Create key material from a 24-word BIP39 mnemonic phrase
pub fn from_bytes(slice: &[u8]) -> Result<Self, Error>
[src]
Create new key material from a byte slice.
Byte slice is expected to have been generated by a cryptographically secure random number generator.
pub fn new(bytes: [u8; 32]) -> KeyMaterial
[src]
Import existing key material - must be uniformly random!
pub fn as_bytes(&self) -> &[u8]
[src]
Borrow the key material as a byte slice
pub fn derive_subkey<P>(self, path: P) -> Self where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Derive an output key from the given input key material
pub fn to_bech32<S>(&self, hrp: S) -> Zeroizing<String> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Serialize this KeyMaterial
as a self-zeroizing Bech32 string
Trait Implementations
impl From<[u8; 32]> for KeyMaterial
[src]
impl From<Phrase> for KeyMaterial
[src]
fn from(phrase: Phrase) -> KeyMaterial
[src]
Convert to KeyMaterial
using an empty password
impl<'a> TryFrom<&'a [u8]> for KeyMaterial
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(slice: &'a [u8]) -> Result<Self, Error>
[src]
impl Drop for KeyMaterial
[src]
impl Clone for KeyMaterial
[src]
fn clone(&self) -> KeyMaterial
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Zeroize for KeyMaterial
[src]
Auto Trait Implementations
impl Unpin for KeyMaterial
impl Send for KeyMaterial
impl Sync for KeyMaterial
impl UnwindSafe for KeyMaterial
impl RefUnwindSafe for KeyMaterial
Blanket Implementations
impl<T> From<T> for 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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> Same<T> for T
type Output = T
Should always be Self
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,