Struct cml_crypto_wasm::Bip32PublicKey
source · 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_raw_bytes(bytes: &[u8]) -> Result<Bip32PublicKey, JsError>
pub fn to_raw_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>
Trait Implementations§
source§impl AsRef<Bip32PublicKey> for Bip32PublicKey
impl AsRef<Bip32PublicKey> for Bip32PublicKey
source§fn as_ref(&self) -> &Bip32PublicKey
fn as_ref(&self) -> &Bip32PublicKey
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for Bip32PublicKey
impl Clone for Bip32PublicKey
source§fn clone(&self) -> Bip32PublicKey
fn clone(&self) -> Bip32PublicKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl From<Bip32PublicKey> for Bip32PublicKey
impl From<Bip32PublicKey> for Bip32PublicKey
source§fn from(inner: Bip32PublicKey) -> Self
fn from(inner: Bip32PublicKey) -> Self
Converts to this type from the input type.
source§impl From<Bip32PublicKey> for Bip32PublicKey
impl From<Bip32PublicKey> for Bip32PublicKey
source§fn from(wrapper: Bip32PublicKey) -> Self
fn from(wrapper: Bip32PublicKey) -> Self
Converts to this type from the input type.
source§impl From<Bip32PublicKey> for JsValue
impl From<Bip32PublicKey> for JsValue
source§fn from(value: Bip32PublicKey) -> Self
fn from(value: Bip32PublicKey) -> Self
Converts to this type from the input type.
source§impl FromWasmAbi for Bip32PublicKey
impl FromWasmAbi for Bip32PublicKey
source§impl IntoWasmAbi for Bip32PublicKey
impl IntoWasmAbi for Bip32PublicKey
source§impl OptionFromWasmAbi for Bip32PublicKey
impl OptionFromWasmAbi for Bip32PublicKey
source§impl OptionIntoWasmAbi for Bip32PublicKey
impl OptionIntoWasmAbi for Bip32PublicKey
source§impl RefFromWasmAbi for Bip32PublicKey
impl RefFromWasmAbi for Bip32PublicKey
§type Anchor = Ref<'static, Bip32PublicKey>
type Anchor = Ref<'static, Bip32PublicKey>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§impl RefMutFromWasmAbi for Bip32PublicKey
impl RefMutFromWasmAbi for Bip32PublicKey
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.