Struct eth_utils::ecdsa_keys::SecpPair
source · [−]pub struct SecpPair { /* private fields */ }
Expand description
A secp256k1 key pair.
Implementations
sourceimpl SecpPair
impl SecpPair
pub fn generate() -> (Self, [u8; 32])
sourcepub fn generate_with_phrase(
password: Option<&str>
) -> (SecpPair, String, [u8; 32])
pub fn generate_with_phrase(
password: Option<&str>
) -> (SecpPair, String, [u8; 32])
Generate new secure (random) key pair and provide the recovery phrase.
You can recover the same key later with from_phrase
.
sourcepub fn from_phrase(
phrase: &str,
password: Option<&str>
) -> Result<(SecpPair, [u8; 32])>
pub fn from_phrase(
phrase: &str,
password: Option<&str>
) -> Result<(SecpPair, [u8; 32])>
Generate key pair from given recovery phrase and password.
sourcepub fn from_seed(seed: &[u8; 32]) -> SecpPair
pub fn from_seed(seed: &[u8; 32]) -> SecpPair
Make a new key pair from secret seed material.
You should never need to use this; generate(), generate_with_phrase
sourcepub fn from_seed_slice(seed_slice: &[u8]) -> Result<SecpPair>
pub fn from_seed_slice(seed_slice: &[u8]) -> Result<SecpPair>
Make a new key pair from secret seed material. The slice must be 32 bytes long or it
will return None
.
You should never need to use this; generate(), generate_with_phrase
sourcepub fn verify<M: AsRef<[u8]>>(
sig: &Signature,
message: M,
pubkey: &Public
) -> bool
pub fn verify<M: AsRef<[u8]>>(
sig: &Signature,
message: M,
pubkey: &Public
) -> bool
Verify a signature on a message. Returns true if the signature is good.
sourcepub fn to_raw_vec(self) -> Vec<u8>
pub fn to_raw_vec(self) -> Vec<u8>
Return a vec filled with raw data.
Trait Implementations
impl Copy for SecpPair
impl Eq for SecpPair
impl StructuralEq for SecpPair
impl StructuralPartialEq for SecpPair
Auto Trait Implementations
impl RefUnwindSafe for SecpPair
impl Send for SecpPair
impl Sync for SecpPair
impl Unpin for SecpPair
impl UnwindSafe for SecpPair
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more