pub struct KeyPair { /* private fields */ }
Expand description
Pair of matching secret and public keys.
Prefer using this struct to (PublicKey, SecretKey)
, since it asserts that public
and secret keys necessarily match.
Implementations§
Source§impl KeyPair
impl KeyPair
Sourcepub fn from_keys(public_key: PublicKey, secret_key: SecretKey) -> Self
pub fn from_keys(public_key: PublicKey, secret_key: SecretKey) -> Self
Creates a keypair from the provided keys, checking that they correspond to each other.
§Panics
- If the keys do not match.
Sourcepub fn random() -> Self
pub fn random() -> Self
Generates a random keypair using the random number generator provided by the crypto backend.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Gets the public key.
Sourcepub fn secret_key(&self) -> &SecretKey
pub fn secret_key(&self) -> &SecretKey
Gets a reference to the secret key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for KeyPair
impl<'de> Deserialize<'de> for KeyPair
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for KeyPair
impl StructuralPartialEq for KeyPair
Auto Trait Implementations§
impl Freeze for KeyPair
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)