introduce keystore selector for golgi

This commit is contained in:
glyph 2022-05-11 16:42:11 +02:00
parent 97680f9010
commit c21e2d090c
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
use async_std::task;
use golgi::Sbot;
use golgi::{sbot::Keystore, Sbot};
use log::debug;
use nanorand::{Rng, WyRand};
use sha3::{Digest, Sha3_256};
@ -126,11 +126,13 @@ async fn publish_private_msg(msg: &str, recipient: &str) -> Result<(), String> {
// TODO: panics if we pass `Some(conf.shscap)` as second arg
Some(conf) => {
let ip_port = conf.lis.clone();
Sbot::init(Some(ip_port), None)
Sbot::init(Keystore::GoSbot, Some(ip_port), None)
.await
.map_err(|e| e.to_string())?
}
None => Sbot::init(None, None).await.map_err(|e| e.to_string())?,
None => Sbot::init(Keystore::GoSbot, None, None)
.await
.map_err(|e| e.to_string())?,
};
debug!("Publishing a Scuttlebutt private message with temporary password");

View File

@ -12,7 +12,9 @@ use std::{
use async_std::task;
use dirs;
use futures::stream::TryStreamExt;
use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot};
use golgi::{
api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, sbot::Keystore, Sbot,
};
use log::debug;
use peach_lib::sbot::SbotConfig;
use rouille::input::post::BufferedFile;
@ -70,9 +72,9 @@ pub async fn init_sbot_with_config(
// TODO: panics if we pass `Some(conf.shscap)` as second arg
Some(conf) => {
let ip_port = conf.lis.clone();
Sbot::init(Some(ip_port), None).await?
Sbot::init(Keystore::GoSbot, Some(ip_port), None).await?
}
None => Sbot::init(None, None).await?,
None => Sbot::init(Keystore::GoSbot, None, None).await?,
};
Ok(sbot_client)