Skip to content

Commit

Permalink
docs: some minor docs cleanup
Browse files Browse the repository at this point in the history
Addresses some warnings that are emitted by `cargo doc --all --no-deps`.
  • Loading branch information
SimonThormeyer committed Jan 21, 2025
1 parent ac2db50 commit 4945729
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
5 changes: 1 addition & 4 deletions crypto/src/mls/external_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ impl CentralContext {
///
/// If the Delivery Service accepts the external commit, you have to [CentralContext::merge_pending_group_from_external_commit]
/// in order to get back a functional MLS group. On the opposite, if it rejects it, you can either
/// retry by just calling again [CentralContext::join_by_external_commit], no need to [CentralContext::clear_pending_group_from_external_commit].
/// If you want to abort the operation (too many retries or the user decided to abort), you can use
/// [CentralContext::clear_pending_group_from_external_commit] in order not to bloat the user's storage but nothing
/// bad can happen if you forget to except some storage space wasted.
/// retry by just calling again [CentralContext::join_by_external_commit].
///
/// # Arguments
/// * `group_info` - a GroupInfo wrapped in a MLS message. it can be obtained by deserializing a TLS serialized `GroupInfo` object
Expand Down
42 changes: 21 additions & 21 deletions crypto/src/proteus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl ProteusConversationSession {
impl CoreCrypto {
/// Proteus session accessor
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session(
&self,
session_id: &str,
Expand All @@ -97,7 +97,7 @@ impl CoreCrypto {

/// Proteus session exists
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_exists(&self, session_id: &str) -> Result<bool> {
let mut mutex = self.proteus.lock().await;
let proteus = mutex.as_mut().ok_or(Error::ProteusNotInitialized)?;
Expand All @@ -112,7 +112,7 @@ impl CoreCrypto {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint(&self) -> Result<String> {
let mutex = self.proteus.lock().await;
let proteus = mutex.as_ref().ok_or(Error::ProteusNotInitialized)?;
Expand All @@ -121,7 +121,7 @@ impl CoreCrypto {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint_local(&self, session_id: &str) -> Result<String> {
let mut mutex = self.proteus.lock().await;
let proteus = mutex.as_mut().ok_or(Error::ProteusNotInitialized)?;
Expand All @@ -131,7 +131,7 @@ impl CoreCrypto {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint_remote(&self, session_id: &str) -> Result<String> {
let mut mutex = self.proteus.lock().await;
let proteus = mutex.as_mut().ok_or(Error::ProteusNotInitialized)?;
Expand All @@ -157,7 +157,7 @@ impl CentralContext {

/// Reloads the sessions from the key store
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or it will do nothing
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or it will do nothing
pub async fn proteus_reload_sessions(&self) -> Result<()> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -168,7 +168,7 @@ impl CentralContext {

/// Creates a proteus session from a prekey
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_from_prekey(
&self,
session_id: &str,
Expand All @@ -186,7 +186,7 @@ impl CentralContext {

/// Creates a proteus session from a Proteus message envelope
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_from_message(
&self,
session_id: &str,
Expand All @@ -206,7 +206,7 @@ impl CentralContext {

/// Saves a proteus session in the keystore
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_save(&self, session_id: &str) -> Result<()> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -217,7 +217,7 @@ impl CentralContext {

/// Deletes a proteus session from the keystore
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_delete(&self, session_id: &str) -> Result<()> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -228,7 +228,7 @@ impl CentralContext {

/// Proteus session accessor
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session(
&self,
session_id: &str,
Expand All @@ -242,7 +242,7 @@ impl CentralContext {

/// Proteus session exists
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_session_exists(&self, session_id: &str) -> Result<bool> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -253,7 +253,7 @@ impl CentralContext {

/// Decrypts a proteus message envelope
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_decrypt(&self, session_id: &str, ciphertext: &[u8]) -> Result<Vec<u8>> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -264,7 +264,7 @@ impl CentralContext {

/// Encrypts proteus message for a given session ID
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_encrypt(&self, session_id: &str, plaintext: &[u8]) -> Result<Vec<u8>> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -276,7 +276,7 @@ impl CentralContext {
/// Encrypts a proteus message for several sessions ID. This is more efficient than other methods as the calls are batched.
/// This also reduces the rountrips when crossing over the FFI
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_encrypt_batched(
&self,
sessions: &[impl AsRef<str>],
Expand All @@ -291,7 +291,7 @@ impl CentralContext {

/// Creates a new Proteus prekey and returns the CBOR-serialized version of the prekey bundle
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_new_prekey(&self, prekey_id: u16) -> Result<Vec<u8>> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -302,7 +302,7 @@ impl CentralContext {

/// Creates a new Proteus prekey with an automatically incremented ID and returns the CBOR-serialized version of the prekey bundle
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_new_prekey_auto(&self) -> Result<(u16, Vec<u8>)> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -328,7 +328,7 @@ impl CentralContext {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint(&self) -> Result<String> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -338,7 +338,7 @@ impl CentralContext {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint_local(&self, session_id: &str) -> Result<String> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -349,7 +349,7 @@ impl CentralContext {

/// Returns the proteus identity's public key fingerprint
///
/// Warning: The Proteus client **MUST** be initialized with [CoreCrypto::proteus_init] first or an error will be returned
/// Warning: The Proteus client **MUST** be initialized with [CentralContext::proteus_init] first or an error will be returned
pub async fn proteus_fingerprint_remote(&self, session_id: &str) -> Result<String> {
let arc = self.proteus_central().await?;
let mut mutex = arc.lock().await;
Expand All @@ -360,7 +360,7 @@ impl CentralContext {

/// Migrates an existing Cryptobox data store (whether a folder or an IndexedDB database) located at `path` to the keystore.
///
///The client can then be initialized with [CoreCrypto::proteus_init]
///The client can then be initialized with [CentralContext::proteus_init]
pub async fn proteus_cryptobox_migrate(&self, path: &str) -> Result<()> {
let keystore = self.keystore().await?;
ProteusCentral::cryptobox_migrate(&keystore, path).await
Expand Down

0 comments on commit 4945729

Please sign in to comment.