From e5bb114c71895375770ebb055a18dce3f0267825 Mon Sep 17 00:00:00 2001 From: nworbnhoj Date: Mon, 11 Dec 2023 06:19:36 +1100 Subject: [PATCH] add sigchat doco --- apps/sigchat/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/sigchat/src/lib.rs b/apps/sigchat/src/lib.rs index c5bad46ff..fe0f95466 100644 --- a/apps/sigchat/src/lib.rs +++ b/apps/sigchat/src/lib.rs @@ -47,6 +47,14 @@ impl<'a> SigChat<'a> { /// Connect to the Signal servers /// + /// The process first waits for an active WiFi connection, and then + /// initiates a Signal Account Manager with the Signal Account struct stored + /// in the pddb (or kicks off the Account setup process otherwise). The + /// Account Manager orchestrates the interaction with the Signal host server. + /// + /// # Returns + /// true on a successful connection to a Signal Account/Server + /// pub fn connect(&mut self) -> Result { log::info!("Attempting connect to Signal server"); if self.wifi() { @@ -84,6 +92,16 @@ impl<'a> SigChat<'a> { /// Setup a Signal Account via Registration or Linking, /// or abort setup and read existing chat Dialogues in pddb /// + /// The user can choose to: + /// 1. Link to an existing Signal Account + /// 2. Register a new Signal Account + /// 3. Abort account setup to read existing Signal Dialogues stored in the pddb + /// The online options involve nominating the Signal host server, + /// and probing the host for trusted tlls Certificate Authorities. + /// + /// # Returns + /// Account struct stored in pddb + /// fn account_setup(&mut self) -> Result { log::info!("Attempting to setup a Signal Account"); self.modals @@ -177,6 +195,15 @@ impl<'a> SigChat<'a> { /// Signal allows to link additional devices to your primary device (e.g. Signal-Android). /// Note that currently Signal allows up to three linked devices per primary. /// + /// The user must provide a name for the current device before the Link process + /// commences - culminating by presenting a qr-code to be scanned by the primary device. + /// + /// # Arguments + /// * `host` - the Signal server host name or ip-address + /// + /// # Returns + /// Account struct stored in pddb + /// pub fn account_link(&mut self, host: &str) -> Result { log::info!("Attempting to Link to an existing Signal Account"); match Account::new(SIGCHAT_ACCOUNT) { @@ -306,6 +333,9 @@ impl<'a> SigChat<'a> { /// If wifi is not connected then a modal offers to "Connect to wifi?" /// and tries for 10 seconds before representing. /// + /// # Returns + /// true when wifi is connected + /// pub fn wifi(&self) -> bool { if HOSTED_MODE { return true;