add sigchat doco

This commit is contained in:
nworbnhoj 2023-12-11 06:19:36 +11:00
parent 572dcd6bd1
commit e5bb114c71

View file

@ -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<bool, Error> {
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<Account, Error> {
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<Account, Error> {
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;