diff --git a/Cargo.lock b/Cargo.lock index 2801b0a..656212e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,7 +543,7 @@ dependencies = [ [[package]] name = "golgi" -version = "0.1.1" +version = "0.1.2" dependencies = [ "async-std", "async-stream 0.3.2", @@ -639,8 +639,7 @@ dependencies = [ [[package]] name = "kuska-ssb" -version = "0.4.0" -source = "git+https://github.com/Kuska-ssb/ssb#fb7062de606e7c9cae8dd4df402a122db46c1b77" +version = "0.4.1" dependencies = [ "async-std", "async-stream 0.2.1", diff --git a/Cargo.toml b/Cargo.toml index 460122c..a2e2a1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "golgi" -version = "0.1.1" +version = "0.1.2" edition = "2021" authors = ["Max Fowler ", "Andrew Reid "] readme = "README.md" @@ -19,7 +19,8 @@ futures = "0.3.21" hex = "0.4.3" kuska-handshake = { version = "0.2.0", features = ["async_std"] } kuska-sodiumoxide = "0.2.5-0" -kuska-ssb = { git = "https://github.com/Kuska-ssb/ssb" } +#kuska-ssb = { git = "https://github.com/Kuska-ssb/ssb" } +kuska-ssb = { path = "../kuska-ssb" } serde = { version = "1", features = ["derive"] } serde_json = "1" sha2 = "0.10.2" diff --git a/src/sbot.rs b/src/sbot.rs index fdf1771..140b95d 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -20,6 +20,10 @@ pub enum Keystore { Patchwork, /// GoSbot default keystore path: `.ssb-go/secret` in the user's home directory. GoSbot, + /// GoSbot keystore in a custom location + CustomGoSbot(String), + /// Patchwork keystore in a custom location + CustomPatchwork(String), } /// A struct representing a connection with a running sbot. @@ -69,10 +73,26 @@ impl Sbot { let OwnedIdentity { pk, sk, id } = match keystore { Keystore::Patchwork => keystore::from_patchwork_local() .await - .expect("couldn't read local secret"), + .expect("couldn't read local patchwork secret from default location"), Keystore::GoSbot => keystore::from_gosbot_local() .await - .expect("couldn't read local secret"), + .expect("couldn't read local go-sbot secret from default location"), + Keystore::CustomGoSbot(key_path) => { + keystore::from_custom_gosbot_keypath(key_path.to_string()) + .await + .expect(&format!( + "couldn't read local go-sbot secret from: {}", + key_path + )) + } + Keystore::CustomPatchwork(key_path) => { + keystore::from_custom_patchwork_keypath(key_path.to_string()) + .await + .expect(&format!( + "couldn't read local patchwork secret from: {}", + key_path + )) + } }; Ok(Self {