pub struct PrivateKey(/* private fields */);
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.
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
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