[][src]Struct ethcontract::secret::PrivateKey

pub struct PrivateKey(_);

A secret key used for signing and hashing.

This type has a safe Debug implementation that does not leak information. Additionally, it implements Drop to zeroize the memory to make leaking passwords less likely.

Methods

impl PrivateKey[src]

pub fn from_raw(raw: [u8; 32]) -> Result<Self, InvalidPrivateKey>[src]

Creates a new private key from raw bytes.

pub fn from_slice<B: AsRef<[u8]>>(raw: B) -> Result<Self, InvalidPrivateKey>[src]

Creates a new private key from a slice of bytes.

pub fn from_hex_str<S: AsRef<str>>(s: S) -> Result<Self, InvalidPrivateKey>[src]

Creates a new private key from a hex string representation. Accepts hex string with or without leading "0x".

pub fn public_address(&self) -> Address[src]

Gets the public address for a given private key.

Methods from Deref<Target = SecretKey>

pub fn as_ptr(&self) -> *const u8

Converts the object to a raw pointer for FFI interfacing

pub fn len(&self) -> usize

Returns the length of the object as an array

pub fn is_empty(&self) -> bool

Returns whether the object as an array is empty

Trait Implementations

impl Clone for PrivateKey[src]

impl Debug for PrivateKey[src]

impl Deref for PrivateKey[src]

type Target = SecretKey

The resulting type after dereferencing.

impl FromStr for PrivateKey[src]

type Err = InvalidPrivateKey

The associated error which can be returned from parsing.

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,