[−][src]Struct ethereum_rust_utils::PrivateKey
Private key used as x in an ECDSA signature
Methods
impl PrivateKey[src]
impl PrivateKeypub fn gen() -> Self[src]
pub fn gen() -> SelfGenerate a new PrivateKey at random (rand::OsRng)
pub fn gen_custom<R: Rng>(rng: &mut R) -> Self[src]
pub fn gen_custom<R: Rng>(rng: &mut R) -> SelfGenerate a new PrivateKey with given custom random generator
pub fn try_from(data: &[u8]) -> Result<Self, Error>[src]
pub fn try_from(data: &[u8]) -> Result<Self, Error>Try to convert a byte slice into PrivateKey.
Arguments
data- A byte slice withPRIVATE_KEY_BYTESlength
Example
const PKB: usize = emerald_rs::PRIVATE_KEY_BYTES; let pk = emerald_rs::PrivateKey::try_from(&[0u8; PKB]).unwrap(); assert_eq!(pk.to_string(), "0x0000000000000000000000000000000000000000000000000000000000000000");
pub fn to_address(self) -> Result<Address, Error>[src]
pub fn to_address(self) -> Result<Address, Error>Extract Address from current private key.
pub fn sign_message(&self, msg: &str) -> Result<Signature, Error>[src]
pub fn sign_message(&self, msg: &str) -> Result<Signature, Error>Sign message
pub fn sign_bytes(&self, data: &[u8]) -> Result<Signature, Error>[src]
pub fn sign_bytes(&self, data: &[u8]) -> Result<Signature, Error>Sign a slice of bytes
pub fn sign_hash(&self, hash: [u8; 32]) -> Result<Signature, Error>[src]
pub fn sign_hash(&self, hash: [u8; 32]) -> Result<Signature, Error>Sign hash from message (Keccak-256)
Trait Implementations
impl Clone for PrivateKey[src]
impl Clone for PrivateKeyfn clone(&self) -> PrivateKey[src]
fn clone(&self) -> PrivateKeyfn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl Copy for PrivateKey[src]
impl Copy for PrivateKeyimpl From<[u8; 32]> for PrivateKey[src]
impl From<[u8; 32]> for PrivateKeyimpl From<SecretKey> for PrivateKey[src]
impl From<SecretKey> for PrivateKeyimpl Into<SecretKey> for PrivateKey[src]
impl Into<SecretKey> for PrivateKeyimpl Eq for PrivateKey[src]
impl Eq for PrivateKeyimpl PartialOrd<PrivateKey> for PrivateKey[src]
impl PartialOrd<PrivateKey> for PrivateKeyfn partial_cmp(&self, other: &PrivateKey) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &PrivateKey) -> Option<Ordering>fn lt(&self, other: &PrivateKey) -> bool[src]
fn lt(&self, other: &PrivateKey) -> boolfn le(&self, other: &PrivateKey) -> bool[src]
fn le(&self, other: &PrivateKey) -> boolfn gt(&self, other: &PrivateKey) -> bool[src]
fn gt(&self, other: &PrivateKey) -> boolfn ge(&self, other: &PrivateKey) -> bool[src]
fn ge(&self, other: &PrivateKey) -> boolimpl Default for PrivateKey[src]
impl Default for PrivateKeyfn default() -> PrivateKey[src]
fn default() -> PrivateKeyimpl PartialEq<PrivateKey> for PrivateKey[src]
impl PartialEq<PrivateKey> for PrivateKeyfn eq(&self, other: &PrivateKey) -> bool[src]
fn eq(&self, other: &PrivateKey) -> boolfn ne(&self, other: &PrivateKey) -> bool[src]
fn ne(&self, other: &PrivateKey) -> boolimpl Ord for PrivateKey[src]
impl Ord for PrivateKeyfn cmp(&self, other: &PrivateKey) -> Ordering[src]
fn cmp(&self, other: &PrivateKey) -> Orderingfn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> Self1.21.0
[src]Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> Self1.21.0
[src]Compares and returns the minimum of two values. Read more
impl Debug for PrivateKey[src]
impl Debug for PrivateKeyimpl Display for PrivateKey[src]
impl Display for PrivateKeyimpl Deref for PrivateKey[src]
impl Deref for PrivateKeyimpl Hash for PrivateKey[src]
impl Hash for PrivateKeyfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0
[src]Feeds a slice of this type into the given [Hasher]. Read more
impl FromStr for PrivateKey[src]
impl FromStr for PrivateKeyAuto Trait Implementations
impl Send for PrivateKey
impl Send for PrivateKeyimpl Sync for PrivateKey
impl Sync for PrivateKeyBlanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToString for T where
T: Display + ?Sized, [src]
impl<T> ToString for T where
T: Display + ?Sized, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeIdimpl<T> Same for T
impl<T> Same for Ttype Output = T
Should always be Self
impl<T> Erased for T
impl<T> Erased for Timpl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, fn equivalent(&self, key: &K) -> bool[src]
fn equivalent(&self, key: &K) -> bool