pub struct ExtendedSpendingKey { /* private fields */ }Expand description
A Sapling extended spending key
The incoming viewing keys of both the external and the internal full viewing key
derived from an ExtendedSpendingKey are never zero.
If the zeroize feature is enabled, the key material is zeroized on drop.
Implementations§
Source§impl ExtendedSpendingKey
impl ExtendedSpendingKey
Sourcepub fn master(seed: &[u8]) -> Option<Self>
pub fn master(seed: &[u8]) -> Option<Self>
Derives the master extended spending key from a seed.
Returns None if the master key is invalid: if it has ask = 0, or if the
incoming viewing key of its external or internal full viewing key is zero. This
has a negligible probability of occurring.
Sourcepub fn from_bytes(b: &[u8]) -> Result<Self, DecodingError>
pub fn from_bytes(b: &[u8]) -> Result<Self, DecodingError>
Decodes the extended spending key from its serialized representation as defined in ZIP 32
Returns an error if the incoming viewing key of the external or internal full viewing key is zero.
Sourcepub fn read<R: Read>(reader: R) -> Result<Self>
pub fn read<R: Read>(reader: R) -> Result<Self>
Reads and decodes the encoded form of the extended spending key as defined in ZIP 32 from the provided reader.
Sourcepub fn to_bytes(&self) -> [u8; 169]
pub fn to_bytes(&self) -> [u8; 169]
Encodes the extended spending key to its serialized representation as defined in ZIP 32
The returned array is secret key material; the caller is responsible for zeroizing it once it is no longer needed.
Sourcepub fn write<W: Write>(&self, writer: W) -> Result<()>
pub fn write<W: Write>(&self, writer: W) -> Result<()>
Writes the encoded form of the extended spending key as defined in ZIP 32 to the provided writer.
Sourcepub fn from_path(
master: &ExtendedSpendingKey,
path: &[ChildIndex],
) -> Option<Self>
pub fn from_path( master: &ExtendedSpendingKey, path: &[ChildIndex], ) -> Option<Self>
Returns the child key corresponding to the path derived from the master key
Returns None if any key along the path is invalid. See Self::derive_child.
Sourcepub fn derive_child(&self, i: ChildIndex) -> Option<Self>
pub fn derive_child(&self, i: ChildIndex) -> Option<Self>
Derives the child key at the given (hardened) index.
Returns None if the child key is invalid: if it has ask = 0, or if the
incoming viewing key of its external or internal full viewing key is zero. This
has a negligible probability of occurring. ZIP 32 directs the caller to proceed
with the next index in that case.
Sourcepub fn default_address(&self) -> (DiversifierIndex, PaymentAddress)
pub fn default_address(&self) -> (DiversifierIndex, PaymentAddress)
Returns the address with the lowest valid diversifier index, along with the diversifier index that generated that address.
Sourcepub fn derive_internal(&self) -> Option<Self>
pub fn derive_internal(&self) -> Option<Self>
Derives an internal spending key given an external spending key.
Returns None if the internal spending key does not satisfy the invariant of
ExtendedSpendingKey: that is, if the incoming viewing key of the internal full
viewing key derived from the internal spending key is zero. This has a negligible
probability of occurring.
Specified in ZIP 32.
Sourcepub fn expsk(&self) -> &ExpandedSpendingKey
pub fn expsk(&self) -> &ExpandedSpendingKey
Returns the expanded spending key component of this extended spending key.
pub fn to_extended_full_viewing_key(&self) -> ExtendedFullViewingKey
Use to_diversifiable_full_viewing_key instead.
pub fn to_diversifiable_full_viewing_key(&self) -> DiversifiableFullViewingKey
Trait Implementations§
Source§impl Clone for ExtendedSpendingKey
impl Clone for ExtendedSpendingKey
Source§impl Debug for ExtendedSpendingKey
impl Debug for ExtendedSpendingKey
Source§impl Drop for ExtendedSpendingKey
Available on crate feature zeroize only.
impl Drop for ExtendedSpendingKey
zeroize only.Source§impl PartialEq for ExtendedSpendingKey
impl PartialEq for ExtendedSpendingKey
Source§impl Zeroize for ExtendedSpendingKey
Available on crate feature zeroize only.
impl Zeroize for ExtendedSpendingKey
zeroize only.impl ZeroizeOnDrop for ExtendedSpendingKey
zeroize only.Auto Trait Implementations§
impl Freeze for ExtendedSpendingKey
impl RefUnwindSafe for ExtendedSpendingKey
impl Send for ExtendedSpendingKey
impl Sync for ExtendedSpendingKey
impl Unpin for ExtendedSpendingKey
impl UnsafeUnpin for ExtendedSpendingKey
impl UnwindSafe for ExtendedSpendingKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.