pub struct CryptoManager { /* private fields */ }Expand description
Cryptographic manager for E2EE using Matrix Olm/Megolm protocols
Implementations§
Source§impl CryptoManager
impl CryptoManager
Sourcepub fn identity_keys(&self) -> IdentityKeys
pub fn identity_keys(&self) -> IdentityKeys
Get the identity keys for this account
Sourcepub fn generate_one_time_keys(&mut self, count: usize) -> Result<()>
pub fn generate_one_time_keys(&mut self, count: usize) -> Result<()>
Generate one-time keys with rate limiting
Sourcepub fn one_time_keys(&self) -> HashMap<String, String>
pub fn one_time_keys(&self) -> HashMap<String, String>
Get one-time keys
Sourcepub fn mark_keys_as_published(&mut self)
pub fn mark_keys_as_published(&mut self)
Mark one-time keys as published
Sourcepub fn create_group_session(&mut self, room_id: &str) -> Result<String>
pub fn create_group_session(&mut self, room_id: &str) -> Result<String>
Create an outbound group session for a room with validation and limits
Sourcepub fn encrypt_room_message(
&mut self,
room_id: &str,
plaintext: &str,
) -> Result<EncryptedMessage>
pub fn encrypt_room_message( &mut self, room_id: &str, plaintext: &str, ) -> Result<EncryptedMessage>
Encrypt a message for a room using Megolm
Sourcepub fn add_inbound_group_session(
&mut self,
session_key_base64: &str,
) -> Result<String>
pub fn add_inbound_group_session( &mut self, session_key_base64: &str, ) -> Result<String>
Add an inbound group session for decrypting room messages
Sourcepub fn decrypt_room_message(
&mut self,
session_id: &str,
ciphertext: &str,
) -> Result<String>
pub fn decrypt_room_message( &mut self, session_id: &str, ciphertext: &str, ) -> Result<String>
Decrypt a room message using Megolm
Sourcepub fn export_account(&self, passphrase: &str) -> Result<String>
pub fn export_account(&self, passphrase: &str) -> Result<String>
Export the account as a pickle (serialized format) with PBKDF2 key derivation Returns base64-encoded salt + encrypted pickle
Sourcepub fn import_account(pickle_with_salt: &str, passphrase: &str) -> Result<Self>
pub fn import_account(pickle_with_salt: &str, passphrase: &str) -> Result<Self>
Import an account from a pickle with PBKDF2 key derivation
Sourcepub fn export_group_session(&self, room_id: &str) -> Result<String>
pub fn export_group_session(&self, room_id: &str) -> Result<String>
Get the session key for a room (for sharing with other devices)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CryptoManager
impl RefUnwindSafe for CryptoManager
impl Send for CryptoManager
impl Sync for CryptoManager
impl Unpin for CryptoManager
impl UnwindSafe for CryptoManager
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more