diff --git a/part_1_sbot_rocket/src/main.rs b/part_1_sbot_rocket/src/main.rs index 1833582..a287a59 100644 --- a/part_1_sbot_rocket/src/main.rs +++ b/part_1_sbot_rocket/src/main.rs @@ -3,6 +3,7 @@ use std::env; use golgi::{sbot::Keystore, Sbot}; use rocket::{get, launch, routes}; +/// Initialise a connection to a Scuttlebutt server. async fn init_sbot() -> Result { let go_sbot_port = env::var("GO_SBOT_PORT").unwrap_or_else(|_| "8021".to_string()); @@ -15,6 +16,7 @@ async fn init_sbot() -> Result { .map_err(|e| e.to_string()) } +/// Return the public key of the local sbot instance. async fn whoami() -> Result { let mut sbot = init_sbot().await?; sbot.whoami().await.map_err(|e| e.to_string()) diff --git a/part_2_subscribe_form/src/sbot.rs b/part_2_subscribe_form/src/sbot.rs index 8af0514..618d5fa 100644 --- a/part_2_subscribe_form/src/sbot.rs +++ b/part_2_subscribe_form/src/sbot.rs @@ -2,6 +2,7 @@ use std::env; use golgi::{api::friends::RelationshipQuery, sbot::Keystore, Sbot}; +/// Initialise a connection to a Scuttlebutt server. pub async fn init_sbot() -> Result { let go_sbot_port = env::var("GO_SBOT_PORT").unwrap_or_else(|_| "8021".to_string()); @@ -14,12 +15,16 @@ pub async fn init_sbot() -> Result { .map_err(|e| e.to_string()) } +/// Return the public key of the local sbot instance. pub async fn whoami() -> Result { let mut sbot = init_sbot().await?; sbot.whoami().await.map_err(|e| e.to_string()) } +/// Check follow status. +/// +/// Is peer A (`public_key_a`) following peer B (`public_key_b`)? pub async fn is_following(public_key_a: &str, public_key_b: &str) -> Result { let mut sbot = init_sbot().await?;