Struct cardano_multiplatform_lib::crypto::Bip32PublicKey
source · pub struct Bip32PublicKey(_);
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>
Trait Implementations§
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 Debug for Bip32PublicKey
impl Debug for Bip32PublicKey
source§impl<'de> Deserialize<'de> for Bip32PublicKey
impl<'de> Deserialize<'de> for Bip32PublicKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for Bip32PublicKey
impl Hash for Bip32PublicKey
source§impl JsonSchema for Bip32PublicKey
impl JsonSchema for Bip32PublicKey
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq<Bip32PublicKey> for Bip32PublicKey
impl PartialEq<Bip32PublicKey> for Bip32PublicKey
source§fn eq(&self, other: &Bip32PublicKey) -> bool
fn eq(&self, other: &Bip32PublicKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.