Struct ethcontract::secret::PrivateKey [−][src]
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.
Implementations
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
[src]
Converts the object to a raw pointer for FFI interfacing
pub fn len(&self) -> usize
[src]
Returns the length of the object as an array
pub fn is_empty(&self) -> bool
[src]
Returns whether the object as an array is empty
Trait Implementations
impl Clone for PrivateKey
[src]
fn clone(&self) -> PrivateKey
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PrivateKey
[src]
impl Deref for PrivateKey
[src]
type Target = SecretKey
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl FromStr for PrivateKey
[src]
type Err = InvalidPrivateKey
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Key for &PrivateKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Key for T where
T: Deref<Target = SecretKey>,
[src]
T: Deref<Target = SecretKey>,
pub fn sign(
&self,
message: &[u8],
chain_id: Option<u64>
) -> Result<Signature, SigningError>
[src]
&self,
message: &[u8],
chain_id: Option<u64>
) -> Result<Signature, SigningError>
pub fn address(&self) -> H160
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,