pub struct Bip32PublicKey(/* private fields */);
Implementations§
Source§impl Bip32PublicKey
impl Bip32PublicKey
Sourcepub fn derive(&self, index: u32) -> Result<Bip32PublicKey, JsError>
pub fn derive(&self, index: u32) -> Result<Bip32PublicKey, JsError>
derive this public key with the given index.
§Errors
If the index is not a soft derivation index (< 0x80000000) then calling this method will fail.
§Security considerations
- hard derivation index cannot be soft derived with the public key
§Hard derivation vs Soft derivation
If you pass an index below 0x80000000 then it is a soft derivation. The advantage of soft derivation is that it is possible to derive the public key too. I.e. derivation the private key with a soft derivation index and then retrieving the associated public key is equivalent to deriving the public key associated to the parent private key.
Hard derivation index does not allow public key derivation.
This is why deriving the private key should not fail while deriving the public key may fail (if the derivation index is invalid).
pub fn to_raw_key(&self) -> PublicKey
pub fn from_bytes(bytes: &[u8]) -> Result<Bip32PublicKey, JsError>
pub fn as_bytes(&self) -> Vec<u8> ⓘ
pub fn from_bech32(bech32_str: &str) -> Result<Bip32PublicKey, JsError>
pub fn to_bech32(&self) -> String
pub fn chaincode(&self) -> Vec<u8> ⓘ
pub fn to_hex(&self) -> String
pub fn from_hex(hex_str: &str) -> Result<Bip32PublicKey, JsError>
Auto Trait Implementations§
impl Freeze for Bip32PublicKey
impl RefUnwindSafe for Bip32PublicKey
impl Send for Bip32PublicKey
impl Sync for Bip32PublicKey
impl Unpin for Bip32PublicKey
impl UnwindSafe for Bip32PublicKey
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more