update docs and doc example code to use new keystore selector
This commit is contained in:
parent
d6546733aa
commit
9cb8b62843
11
README.md
11
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.
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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";
|
||||
///
|
||||
|
@ -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;
|
||||
///
|
||||
|
@ -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(),
|
||||
|
@ -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();
|
||||
///
|
||||
|
@ -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=";
|
||||
///
|
||||
|
@ -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?;
|
||||
///
|
||||
|
@ -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";
|
||||
///
|
||||
|
@ -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?;
|
||||
///
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user