Add support for custom keyfile paths
This commit is contained in:
parent
0aa616d92b
commit
3f3c18b8b7
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "golgi"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
authors = ["Max Fowler <max@mfowler.info>", "Andrew Reid <glyph@mycelial.technology>"]
|
||||
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"
|
||||
|
|
24
src/sbot.rs
24
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 {
|
||||
|
|
Loading…
Reference in New Issue