pub struct PrivateKey(/* private fields */);Expand description
secp256k1 (K-256) secret key.
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn create_random() -> Self
pub fn create_random() -> Self
Generates a random private key.
§Example
use zilliqa_rs::core::PrivateKey;
let private_key = PrivateKey::create_random();Sourcepub fn from_slice(slice: &[u8]) -> Result<Self, Error>
pub fn from_slice(slice: &[u8]) -> Result<Self, Error>
Constructs a private key from a raw secret key.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns corresponding public key of the private key
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate 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 PrivateKey
impl Debug for PrivateKey
Source§impl Deref for PrivateKey
impl Deref for PrivateKey
Source§impl Display for PrivateKey
impl Display for PrivateKey
Source§impl FromStr for PrivateKey
impl FromStr for PrivateKey
Source§fn from_str(secret_key: &str) -> Result<Self, Self::Err>
fn from_str(secret_key: &str) -> Result<Self, Self::Err>
Create a private key out of a sting slice.
§Example
use zilliqa_rs::core::PrivateKey;
let pv: PrivateKey = "D96e9eb5b782a80ea153c937fa83e5948485fbfc8b7e7c069d7b914dbc350aba"
.parse()
.unwrap();
assert_eq!(
"d96e9eb5b782a80ea153c937fa83e5948485fbfc8b7e7c069d7b914dbc350aba",
pv.to_string()
);Source§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
Source§impl TryFrom<PrivateKey> for LocalWallet
impl TryFrom<PrivateKey> for LocalWallet
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