session_cipher_set_decryption_callback

Function session_cipher_set_decryption_callback 

Source
pub unsafe extern "C" fn session_cipher_set_decryption_callback(
    cipher: *mut session_cipher,
    callback: Option<unsafe extern "C" fn(cipher: *mut session_cipher, plaintext: *mut signal_buffer, decrypt_context: *mut c_void) -> c_int>,
)
Expand description

Set the callback function that is called during the decrypt process.

The callback function is called from within session_cipher_decrypt_pre_key_signal_message() and session_cipher_decrypt_signal_message() after decryption is complete but before the updated session state has been committed to the session store. If the callback function returns a negative value, then the decrypt function will immediately fail with an error.

This a callback allows some implementations to store the committed plaintext to their local message store first, in case they are concerned with a crash or write error happening between the time the session state is updated but before they’re able to successfully store the plaintext to disk.

@param callback the callback function to set