pub struct SharedKey { /* private fields */ }Implementations§
Sourcepub fn new(sk: &PrivateKey, pk: &PublicKey) -> Result<Self, SharedKeyError>
pub fn new(sk: &PrivateKey, pk: &PublicKey) -> Result<Self, SharedKeyError>
Creates a new shared key from a private key and a public key.
§Errors
Returns SharedKeyError::InvalidPublicKey if the public key bytes
do not represent a valid Edwards Y coordinate.
pub fn from_sk(sk: &PrivateKey) -> Self
pub fn encrypt(&self, payload: Vec<u8>, nonce: Nonce) -> Option<Vec<u8>>
pub fn decrypt(&self, cipher_text: Vec<u8>, nonce: Nonce) -> Option<Vec<u8>>
Trait Implementations§
Auto Trait Implementations§
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