Struct saltyrtc_client::crypto::KeyPair [−][src]
pub struct KeyPair { /* fields omitted */ }
Wrapper for holding a public/private key pair and encrypting/decrypting messages.
Methods
impl KeyPair
[src]
impl KeyPair
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new key pair and wrap it in a KeyPair
.
Panics
This may panic if libsodium initialization fails.
pub fn from_private_key(private_key: PrivateKey) -> Self
[src]
pub fn from_private_key(private_key: PrivateKey) -> Self
Create a new key pair from an existing private key.
The private key is consumed and transferred into the KeyPair
.
pub fn from_keypair(public_key: PublicKey, private_key: PrivateKey) -> Self
[src]
pub fn from_keypair(public_key: PublicKey, private_key: PrivateKey) -> Self
Create a new key pair from an existing public and private key.
The two keys are consumed and transferred into the KeyPair
.
pub fn public_key(&self) -> &PublicKey
[src]
pub fn public_key(&self) -> &PublicKey
Return a reference to the public key.
pub fn public_key_hex(&self) -> String
[src]
pub fn public_key_hex(&self) -> String
Return the public key as hex-encoded string.
pub fn private_key(&self) -> &PrivateKey
[src]
pub fn private_key(&self) -> &PrivateKey
Return a reference to the private key.
Warning: Be careful with this! The only reason to access the private key is probably to be able to restore it when working with trusted keys.
pub fn private_key_hex(&self) -> String
[src]
pub fn private_key_hex(&self) -> String
Return the private key as hex-encoded string.
Warning: Be careful with this! The only reason to access the private key is probably to be able to restore it when working with trusted keys.
Trait Implementations
impl Debug for KeyPair
[src]
impl Debug for KeyPair
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for KeyPair
[src]
impl PartialEq for KeyPair
fn eq(&self, other: &KeyPair) -> bool
[src]
fn eq(&self, other: &KeyPair) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &KeyPair) -> bool
[src]
fn ne(&self, other: &KeyPair) -> bool
This method tests for !=
.
impl Eq for KeyPair
[src]
impl Eq for KeyPair