[][src]Struct ed25519_bip32::XPrv

pub struct XPrv(_);

HDWallet extended private key

Effectively this is an ed25519 extended secret key (64 bytes) followed by a chain code (32 bytes).

Implementations

impl XPrv[src]

pub fn normalize_bytes_force3rd(mut bytes: [u8; 96]) -> Self[src]

takes the given raw bytes and perform some modifications to normalize to a valid Ed25519 extended key, but it does also force the 3rd highest bit to be cleared too.

pub fn normalize_bytes_ed25519(mut bytes: [u8; 96]) -> Self[src]

Takes the given raw bytes and perform some modifications to normalize to a valid Ed25519 extended key. It doesn't touch the 3rd highest bit as expected in the ed25519-bip32 paper.

pub fn is_3rd_highest_bit_clear(&self) -> bool[src]

Check if the 3rd highest bit is clear as expected from the paper

pub fn clear_3rd_highest_bit(mut self: Self) -> Self[src]

Clear the 3rd highest bit as expected from the paper setting

pub fn from_nonextended_force(bytes: &[u8; 32], chain_code: &[u8; 32]) -> Self[src]

Takes a non-extended Ed25519 secret key and hash through SHA512 it in the same way the standard Ed25519 signature system make extended key, but also force clear the 3rd highest bit of the key instead of returning an error

pub fn from_nonextended_noforce(
    bytes: &[u8; 32],
    chain_code: &[u8; 32]
) -> Result<Self, ()>
[src]

Takes a non-extended Ed25519 secret key and hash through SHA512 it in the same way the standard Ed25519 signature system make extended key. If the 3rd highest bit is set, then return an error

bip32-ed25519 paper:

"2) We admit only those ~k such that the third highest bit of the last byte of kL is zero."

pub fn from_extended_and_chaincode(sk: &[u8; 64], chain_code: &[u8; 32]) -> Self[src]

create a XPrv by its components (a 64 bytes extended secret key, and a 32 bytes chain code)

No verification is done on the extended secret key

pub fn from_bytes_verified(bytes: [u8; 96]) -> Result<Self, PrivateKeyError>[src]

Create a XPrv by taking ownership of the given array

This function may returns an error if it does not have the expected format.

This function allow the 3rd highest bit to not be clear (to handle potential derived valid xprv), but self.is_3rd_highest_bit_clear() can be called to check if the 3rd highest bit is assumed to be clear or not.

pub fn from_slice_verified(bytes: &[u8]) -> Result<Self, PrivateKeyError>[src]

pub fn public(&self) -> XPub[src]

Get the associated XPub

pub fn sign<T>(&self, message: &[u8]) -> Signature<T>[src]

sign the given message with the XPrv.

pub fn verify<T>(&self, message: &[u8], signature: &Signature<T>) -> bool[src]

verify a given signature

pub fn derive(&self, scheme: DerivationScheme, index: DerivationIndex) -> Self[src]

pub fn get_extended_mut(&self, out: &mut [u8; 64])[src]

pub fn extended_secret_key_slice(&self) -> &[u8][src]

pub fn chain_code_slice(&self) -> &[u8][src]

pub fn extended_secret_key(&self) -> [u8; 64][src]

pub fn chain_code(&self) -> [u8; 32][src]

Trait Implementations

impl AsRef<[u8]> for XPrv[src]

impl Clone for XPrv[src]

impl Debug for XPrv[src]

impl Display for XPrv[src]

impl Drop for XPrv[src]

impl Eq for XPrv[src]

impl PartialEq<XPrv> for XPrv[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.