-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Lines 91 to 106 in 038d715
impl PublicKey { | |
/// Get private key from its bech32 representation | |
/// Example: | |
/// ```javascript | |
/// const pkey = PublicKey.from_bech32('ed25519_pk1dgaagyh470y66p899txcl3r0jaeaxu6yd7z2dxyk55qcycdml8gszkxze2'); | |
/// ``` | |
pub fn from_bech32(bech32_str: &str) -> Result<PublicKey, JsValue> { | |
crypto::PublicKey::try_from_bech32_str(&bech32_str) | |
.map(PublicKey) | |
.map_err(|_| JsValue::from_str("Malformed public key")) | |
} | |
pub fn as_bytes(&self) -> Vec<u8> { | |
self.0.as_ref().to_vec() | |
} | |
} |
SebastienGllmt
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers