Struct cardano_serialization_lib::crypto::PrivateKey
source · pub struct PrivateKey(_);
Implementations§
source§impl PrivateKey
impl PrivateKey
pub fn to_public(&self) -> PublicKey
pub fn generate_ed25519() -> Result<PrivateKey, JsError>
pub fn generate_ed25519extended() -> Result<PrivateKey, JsError>
sourcepub fn from_bech32(bech32_str: &str) -> Result<PrivateKey, JsError>
pub fn from_bech32(bech32_str: &str) -> Result<PrivateKey, JsError>
Get private key from its bech32 representation
PrivateKey.from_bech32('ed25519_sk1ahfetf02qwwg4dkq7mgp4a25lx5vh9920cr5wnxmpzz9906qvm8qwvlts0');
For an extended 25519 key
PrivateKey.from_bech32('ed25519e_sk1gqwl4szuwwh6d0yk3nsqcc6xxc3fpvjlevgwvt60df59v8zd8f8prazt8ln3lmz096ux3xvhhvm3ca9wj2yctdh3pnw0szrma07rt5gl748fp');
pub fn to_bech32(&self) -> String
pub fn as_bytes(&self) -> Vec<u8>
pub fn from_extended_bytes(bytes: &[u8]) -> Result<PrivateKey, JsError>
pub fn from_normal_bytes(bytes: &[u8]) -> Result<PrivateKey, JsError>
pub fn sign(&self, message: &[u8]) -> Ed25519Signature
pub fn to_hex(&self) -> String
pub fn from_hex(hex_str: &str) -> Result<PrivateKey, JsError>
Trait Implementations§
source§impl From<EitherEd25519SecretKey> for PrivateKey
impl From<EitherEd25519SecretKey> for PrivateKey
source§fn from(secret_key: EitherEd25519SecretKey) -> PrivateKey
fn from(secret_key: EitherEd25519SecretKey) -> PrivateKey
Converts to this type from the input type.