crypto: Document when a key export may panic.

master
Damir Jelić 2020-09-18 14:04:39 +02:00
parent 5d5d5bb141
commit dea3e4adf4
3 changed files with 22 additions and 1 deletions

View File

@ -1727,6 +1727,11 @@ impl Client {
/// returns `true` the `InboundGroupSessoin` will be included in the export, /// returns `true` the `InboundGroupSessoin` will be included in the export,
/// if the closure returns `false` it will not be included. /// if the closure returns `false` it will not be included.
/// ///
/// # Panics
///
/// This method will panic if it can't get enough randomness from the OS to
/// encrypt the exported keys securely.
///
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run

View File

@ -122,6 +122,11 @@ pub fn decrypt_key_export(
/// attacks. Should be at least `10000`, while values in the `100000` ranges /// attacks. Should be at least `10000`, while values in the `100000` ranges
/// should be preferred. /// should be preferred.
/// ///
/// # Panics
///
/// This method will panic if it can't get enough randomness from the OS to
/// encrypt the exported keys securely.
///
/// # Examples /// # Examples
/// ```no_run /// ```no_run
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export}; /// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};

View File

@ -172,7 +172,7 @@ impl OlmMachine {
let store = Store::new(store); let store = Store::new(store);
let verification_machine = VerificationMachine::new(account.clone(), store.clone()); let verification_machine = VerificationMachine::new(account.clone(), store.clone());
let user_id = Arc::new(user_id.clone()); let user_id = Arc::new(user_id.clone());
let device_id: Arc<DeviceIdBox> = Arc::new(device_id.into()); let device_id: Arc<DeviceIdBox> = Arc::new(device_id);
let key_request_machine = let key_request_machine =
KeyRequestMachine::new(user_id.clone(), device_id.clone(), store.clone()); KeyRequestMachine::new(user_id.clone(), device_id.clone(), store.clone());
@ -1612,6 +1612,17 @@ impl OlmMachine {
/// Export the keys that match the given predicate. /// Export the keys that match the given predicate.
/// ///
/// # Arguments
///
/// * `predicate` - A closure that will be called for every known
/// `InboundGroupSession`, which represents a room key. If the closure
/// returns `true` the `InboundGroupSessoin` will be included in the export,
/// if the closure returns `false` it will not be included.
///
/// # Panics
///
/// This method will panic if it can't get enough randomness from the OS to
/// encrypt the exported keys securely.
/// ///
/// # Examples /// # Examples
/// ///