From 9cb8b62843e4d5e70155bd8cd356981162f1f206 Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 11 May 2022 14:14:25 +0200 Subject: [PATCH] update docs and doc example code to use new keystore selector --- README.md | 11 +++++----- examples/basic.rs | 9 ++++---- examples/friends.rs | 18 +++++++++------- examples/invite.rs | 9 ++++---- examples/streams.rs | 8 ++++--- src/api/about.rs | 28 ++++++++++++------------- src/api/friends.rs | 44 +++++++++++++++++++-------------------- src/api/get_subset.rs | 5 +++-- src/api/history_stream.rs | 4 ++-- src/api/invite.rs | 8 +++---- src/api/private.rs | 16 +++++++------- src/api/publish.rs | 20 +++++++++--------- src/api/whoami.rs | 4 ++-- src/lib.rs | 4 ++-- 14 files changed, 98 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 84bd232..905d914 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,6 @@ Golgi is an asynchronous, experimental Scuttlebutt client that aims to facilitate Scuttlebutt application development. It provides a high-level API for interacting with an sbot instance and uses the [kuska-ssb](https://github.com/Kuska-ssb) libraries to make RPC calls. -Development efforts are currently oriented towards -[go-sbot](https://github.com/cryptoscope/ssb) interoperability. ## Features @@ -33,12 +31,13 @@ Basic usage is demonstrated below. Visit the [examples directory](https://git.co more comprehensive examples. ```rust -use golgi::{GolgiError, Sbot}; +use golgi::{GolgiError, Sbot, sbot::Keystore}; pub async fn run() -> Result<(), GolgiError> { - // Attempt to initialise a connection to an sbot instance using the default - // IP address, port and network key (aka. capabilities key). - let mut sbot_client = Sbot::init(None, None).await?; + // Attempt to initialise a connection to an sbot instance using the + // secret file at the Patchwork path and the default IP address, port + // and network key (aka. capabilities key). + let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; // Call the `whoami` RPC method to retrieve the public key for the sbot // identity. diff --git a/examples/basic.rs b/examples/basic.rs index 0ab02c0..5d73956 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,14 +1,15 @@ use std::process; -use golgi::{messages::SsbMessageContent, GolgiError, Sbot}; +use golgi::{messages::SsbMessageContent, sbot::Keystore, GolgiError, Sbot}; // Golgi is an asynchronous library so we must call it from within an // async function. The `GolgiError` type encapsulates all possible // error variants for the library. async fn run() -> Result<(), GolgiError> { - // Attempt to connect to an sbot instance using the default IP address, - // port and network key (aka. capabilities key). - let mut sbot_client = Sbot::init(None, None).await?; + // Attempt to initialise a connection to an sbot instance using the + // secret file at the Patchwork path and the default IP address, port + // and network key (aka. capabilities key). + let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; // Alternatively, we could specify a non-standard IP and port. // let ip_port = "127.0.0.1:8021".to_string(); diff --git a/examples/friends.rs b/examples/friends.rs index e7c93db..c0fcf06 100644 --- a/examples/friends.rs +++ b/examples/friends.rs @@ -2,6 +2,7 @@ use std::process; use golgi::{ api::friends::{FriendsHops, RelationshipQuery}, + sbot::Keystore, GolgiError, Sbot, }; @@ -9,9 +10,10 @@ use golgi::{ // async function. The `GolgiError` type encapsulates all possible // error variants for the library. async fn run() -> Result<(), GolgiError> { - // Attempt to connect to an sbot instance using the default IP address, - // port and network key (aka. capabilities key). - let mut sbot_client = Sbot::init(None, None).await?; + // Attempt to initialise a connection to an sbot instance using the + // secret file at the Patchwork path and the default IP address, port + // and network key (aka. capabilities key). + let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; // Call the `whoami` RPC method to retrieve the public key for the sbot // identity. This is our 'local' public key. @@ -26,10 +28,10 @@ async fn run() -> Result<(), GolgiError> { // Set the relationship of the local identity to the `to_follow` identity. // In this case, the `set_relationship` method publishes a `contact` - // message which defines following as `true` and blocking as `false`. + // message which defines following as `true`. // A message reference is returned for the published `contact` message. let response = sbot_client - .set_relationship(&to_follow, true, false) + .set_relationship(&to_follow, Some(true), None) .await?; // Print the message reference to `stdout`. @@ -37,9 +39,11 @@ async fn run() -> Result<(), GolgiError> { // Set the relationship of the local identity to the `to_block` identity. // In this case, the `set_relationship` method publishes a `contact` - // message which defines following as `false` and blocking as `true`. + // message which defines blocking as `true`. // A message reference is returned for the published `contact` message. - let response = sbot_client.set_relationship(&to_block, false, true).await?; + let response = sbot_client + .set_relationship(&to_block, None, Some(true)) + .await?; // Print the message reference to `stdout`. println!("follow_response: {:?}", response); diff --git a/examples/invite.rs b/examples/invite.rs index 5d5881f..faf8302 100644 --- a/examples/invite.rs +++ b/examples/invite.rs @@ -2,15 +2,16 @@ use std::process; use kuska_ssb::api::dto::content::PubAddress; -use golgi::{messages::SsbMessageContent, GolgiError, Sbot}; +use golgi::{messages::SsbMessageContent, sbot::Keystore, GolgiError, Sbot}; // Golgi is an asynchronous library so we must call it from within an // async function. The `GolgiError` type encapsulates all possible // error variants for the library. async fn run() -> Result<(), GolgiError> { - // Attempt to connect to an sbot instance using the default IP address, - // port and network key (aka. capabilities key). - let mut sbot_client = Sbot::init(None, None).await?; + // Attempt to initialise a connection to an sbot instance using the + // secret file at the Patchwork path and the default IP address, port + // and network key (aka. capabilities key). + let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; // Call the `whoami` RPC method to retrieve the public key for the sbot // identity. This is our 'local' public key. diff --git a/examples/streams.rs b/examples/streams.rs index f2c7ffd..d692baa 100644 --- a/examples/streams.rs +++ b/examples/streams.rs @@ -6,6 +6,7 @@ use futures::TryStreamExt; use golgi::{ api::get_subset::{SubsetQuery, SubsetQueryOptions}, messages::{SsbMessageContentType, SsbMessageValue}, + sbot::Keystore, GolgiError, Sbot, }; @@ -13,9 +14,10 @@ use golgi::{ // async function. The `GolgiError` type encapsulates all possible // error variants for the library. async fn run() -> Result<(), GolgiError> { - // Attempt to connect to an sbot instance using the default IP address, - // port and network key (aka. capabilities key). - let mut sbot_client = Sbot::init(None, None).await?; + // Attempt to initialise a connection to an sbot instance using the + // secret file at the Patchwork path and the default IP address, port + // and network key (aka. capabilities key). + let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; // Call the `whoami` RPC method to retrieve the public key for the sbot // identity. This is our 'local' public key. diff --git a/src/api/about.rs b/src/api/about.rs index 824d7f4..d867857 100644 --- a/src/api/about.rs +++ b/src/api/about.rs @@ -29,10 +29,10 @@ impl Sbot { /// /// ```rust /// use async_std::stream::{Stream, StreamExt}; - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn about_message_stream() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -88,10 +88,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn name_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// let key = "name"; @@ -154,10 +154,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn profile_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -196,10 +196,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn name_and_image_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -243,10 +243,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn about_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// let keys_to_search_for = vec!["name", "description"]; @@ -340,10 +340,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn name_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -365,10 +365,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn description_info() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// diff --git a/src/api/friends.rs b/src/api/friends.rs index 8975133..41d8071 100644 --- a/src/api/friends.rs +++ b/src/api/friends.rs @@ -27,10 +27,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn follow_peer() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -56,10 +56,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn unfollow_peer() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -85,10 +85,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn block_peer() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -116,10 +116,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn unblock_peer() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// @@ -142,10 +142,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn relationship() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// let following = Some(true); @@ -184,10 +184,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError, api::friends::RelationshipQuery}; + /// use golgi::{Sbot, GolgiError, api::friends::RelationshipQuery, sbot::Keystore}; /// /// async fn relationship() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let peer_a = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// let peer_b = "@3QoWCcy46X9a4jTnOl8m3+n1gKfbsukWuODDxNGN0W8=.ed25519"; @@ -234,10 +234,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError, api::friends::RelationshipQuery}; + /// use golgi::{Sbot, GolgiError, api::friends::RelationshipQuery, sbot::Keystore}; /// /// async fn relationship() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let peer_a = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519"; /// let peer_b = "@3QoWCcy46X9a4jTnOl8m3+n1gKfbsukWuODDxNGN0W8=.ed25519"; @@ -282,10 +282,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn follows() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let follows = sbot_client.get_blocks().await?; /// @@ -314,10 +314,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn follows() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let follows = sbot_client.get_follows().await?; /// @@ -350,10 +350,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn followers() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// // let followers = sbot_client.get_followers().await?; /// @@ -395,10 +395,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError, api::friends::FriendsHops}; + /// use golgi::{Sbot, GolgiError, api::friends::FriendsHops, sbot::Keystore}; /// /// async fn peers_within_range() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let hops = 2; /// diff --git a/src/api/get_subset.rs b/src/api/get_subset.rs index 8461835..275bfda 100644 --- a/src/api/get_subset.rs +++ b/src/api/get_subset.rs @@ -33,11 +33,12 @@ impl Sbot { /// api::get_subset::{ /// SubsetQuery, /// SubsetQueryOptions - /// } + /// }, + /// sbot::Keystore /// }; /// /// async fn query() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let post_query = SubsetQuery::Type { /// op: "type".to_string(), diff --git a/src/api/history_stream.rs b/src/api/history_stream.rs index 9ff7e44..1a2e4d1 100644 --- a/src/api/history_stream.rs +++ b/src/api/history_stream.rs @@ -16,10 +16,10 @@ impl Sbot { /// /// ```rust /// use async_std::stream::StreamExt; - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn history() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519".to_string(); /// diff --git a/src/api/invite.rs b/src/api/invite.rs index f9379f0..9c4afc1 100644 --- a/src/api/invite.rs +++ b/src/api/invite.rs @@ -15,10 +15,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn invite_code_generator() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let invite_code = sbot_client.invite_create(5).await?; /// @@ -47,10 +47,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn invite_code_consumer() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let invite_code = "127.0.0.1:8008:@0iMa+vP7B2aMrV3dzRxlch/iqZn/UM3S3Oo2oVeILY8=.ed25519~ZHNjeajPB/84NjjsrglZInlh46W55RcNDPcffTPgX/Q="; /// diff --git a/src/api/private.rs b/src/api/private.rs index f341135..8cee292 100644 --- a/src/api/private.rs +++ b/src/api/private.rs @@ -17,21 +17,21 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError, messages::SsbMessageContent}; + /// use golgi::{Sbot, GolgiError, messages::SsbMessageContent, sbot::Keystore}; /// /// async fn publish_a_private_msg() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// - /// let text = String::new("Hi friends, I have a super secrect message to share with you about the wonders of intra-cellular transport mechanics."); + /// let text = String::from("Hi friends, I have a super secrect message to share with you about the wonders of intra-cellular transport mechanics."); /// /// // We must also include the local identity (public key) here if we wish /// // to be able to read the message. Ie. the sender must be included in /// // the list of recipients. - /// let recipients = Vec::new( - /// String::new("@OKRij/n7Uu42A0Z75ty0JI0cZxcieD2NyjXrRdYKNOQ=.ed25519"), - /// String::new("@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519"), - /// String::new("@BVA85B7a/a17v2ZVcLkMgPE+v7X5rQVAHEgQBbCaKMs=.ed25519"), - /// ); + /// let recipients = vec![ + /// String::from("@OKRij/n7Uu42A0Z75ty0JI0cZxcieD2NyjXrRdYKNOQ=.ed25519"), + /// String::from("@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519"), + /// String::from("@BVA85B7a/a17v2ZVcLkMgPE+v7X5rQVAHEgQBbCaKMs=.ed25519"), + /// ]; /// /// let msg_ref = sbot_client.publish_private(text, recipients).await?; /// diff --git a/src/api/publish.rs b/src/api/publish.rs index 5c64706..c6697d3 100644 --- a/src/api/publish.rs +++ b/src/api/publish.rs @@ -23,10 +23,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError, messages::SsbMessageContent}; + /// use golgi::{Sbot, GolgiError, messages::SsbMessageContent, sbot::Keystore}; /// /// async fn publish_a_msg() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// // Construct an SSB message of type `post`. /// let post = SsbMessageContent::Post { @@ -61,10 +61,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn publish_a_post() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let text = "The Golgi is located right near the nucleus."; /// @@ -91,10 +91,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn publish_a_description() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let description = "The Golgi apparatus was identified by the Italian scientist Camillo Golgi in 1897."; /// @@ -130,10 +130,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn publish_an_image() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let blob_id = "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256"; /// @@ -166,10 +166,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn publish_a_name() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let name = "glyphski_golgionikus"; /// diff --git a/src/api/whoami.rs b/src/api/whoami.rs index 8e29871..732d0b8 100644 --- a/src/api/whoami.rs +++ b/src/api/whoami.rs @@ -12,10 +12,10 @@ impl Sbot { /// # Example /// /// ```rust - /// use golgi::{Sbot, GolgiError}; + /// use golgi::{Sbot, GolgiError, sbot::Keystore}; /// /// async fn fetch_id() -> Result<(), GolgiError> { - /// let mut sbot_client = Sbot::init(None, None).await?; + /// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; /// /// let pub_key = sbot_client.whoami().await?; /// diff --git a/src/lib.rs b/src/lib.rs index 4b36222..b96c1fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,12 +38,12 @@ //! more comprehensive examples. //! //! ```rust -//! use golgi::{messages::SsbMessageContent, GolgiError, Sbot}; +//! use golgi::{messages::SsbMessageContent, GolgiError, Sbot, sbot::Keystore}; //! //! pub async fn run() -> Result<(), GolgiError> { //! // Attempt to connect to an sbot instance using the default IP address, //! // port and network key (aka. capabilities key). -//! let mut sbot_client = Sbot::init(None, None).await?; +//! let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?; //! //! // Call the `whoami` RPC method to retrieve the public key for the sbot //! // identity.