[][src]Struct ethereum_rust_utils::PrivateKey

pub struct PrivateKey(pub [u8; 32]);

Private key used as x in an ECDSA signature

Methods

impl PrivateKey
[src]

Generate a new PrivateKey at random (rand::OsRng)

Generate a new PrivateKey with given custom random generator

Try to convert a byte slice into PrivateKey.

Arguments

  • data - A byte slice with PRIVATE_KEY_BYTES length

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");

Extract Address from current private key.

Sign message

Sign a slice of bytes

Sign hash from message (Keccak-256)

Trait Implementations

impl Clone for PrivateKey
[src]

Performs copy-assignment from source. Read more

impl Copy for PrivateKey
[src]

impl From<[u8; 32]> for PrivateKey
[src]

impl From<SecretKey> for PrivateKey
[src]

impl Into<SecretKey> for PrivateKey
[src]

impl Eq for PrivateKey
[src]

impl PartialOrd<PrivateKey> for PrivateKey
[src]

impl Default for PrivateKey
[src]

impl PartialEq<PrivateKey> for PrivateKey
[src]

impl Ord for PrivateKey
[src]

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Debug for PrivateKey
[src]

impl Display for PrivateKey
[src]

impl Deref for PrivateKey
[src]

The resulting type after dereferencing.

impl Hash for PrivateKey
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for PrivateKey
[src]

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for PrivateKey

impl Sync for PrivateKey

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

Should always be Self

impl<T> Erased for T

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]