pub struct SecureChannel {
pub peer_id: DeviceId,
pub established_at: SystemTime,
/* private fields */
}Expand description
Secure channel between two peers
Fields§
§peer_id: DeviceIdPeer identifier
established_at: SystemTimeWhen channel was established
Implementations§
Source§impl SecureChannel
impl SecureChannel
Sourcepub fn new(peer_id: DeviceId, key: SymmetricKey) -> Self
pub fn new(peer_id: DeviceId, key: SymmetricKey) -> Self
Create new secure channel
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<EncryptedData, SecurityError>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<EncryptedData, SecurityError>
Encrypt message for peer
Sourcepub fn decrypt(
&self,
encrypted: &EncryptedData,
) -> Result<Vec<u8>, SecurityError>
pub fn decrypt( &self, encrypted: &EncryptedData, ) -> Result<Vec<u8>, SecurityError>
Decrypt message from peer
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecureChannel
impl RefUnwindSafe for SecureChannel
impl Send for SecureChannel
impl Sync for SecureChannel
impl Unpin for SecureChannel
impl UnsafeUnpin for SecureChannel
impl UnwindSafe for SecureChannel
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