Skip to content
Snippets Groups Projects
Commit cb6b32d6 authored by poka's avatar poka
Browse files

Add Nostr profile support

parent 4010a9e4
Branches
No related tags found
1 merge request!49Draft: Nostr
Pipeline #40616 passed
......@@ -1596,6 +1596,12 @@ dependencies = [
"parking_lot_core",
]
[[package]]
name = "data-encoding"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
[[package]]
name = "der"
version = "0.7.9"
......@@ -2351,6 +2357,7 @@ version = "0.4.2"
dependencies = [
"age",
"anyhow",
"bech32",
"bip39",
"bs58",
"clap",
......@@ -2371,12 +2378,16 @@ dependencies = [
"rstest",
"scrypt",
"sea-orm",
"secp256k1",
"serde",
"serde_json",
"sha2 0.10.8",
"sp-core",
"sp-runtime",
"subxt",
"tokio",
"tokio-tungstenite",
"url",
]
[[package]]
......@@ -5182,6 +5193,7 @@ version = "0.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10"
dependencies = [
"rand",
"secp256k1-sys",
]
......@@ -6752,6 +6764,22 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-tungstenite"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38"
dependencies = [
"futures-util",
"log",
"rustls 0.22.4",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.25.0",
"tungstenite",
"webpki-roots 0.26.6",
]
[[package]]
name = "tokio-util"
version = "0.7.12"
......@@ -6979,6 +7007,27 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tungstenite"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
dependencies = [
"byteorder",
"bytes",
"data-encoding",
"http 1.1.0",
"httparse",
"log",
"rand",
"rustls 0.22.4",
"rustls-pki-types",
"sha1",
"thiserror",
"url",
"utf-8",
]
[[package]]
name = "twox-hash"
version = "1.6.3"
......@@ -7124,6 +7173,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "utf-8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "utf8parse"
version = "0.2.2"
......
......@@ -41,12 +41,17 @@ inquire = "^0.7.5"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0.128"
tokio = { version = "^1.40.0", features = ["macros"] }
tokio-tungstenite = { version = "0.21.0", features = ["rustls-tls-webpki-roots"] }
confy = "^0.5.1"
bs58 = "^0.5.1"
directories = "^5.0.1"
comfy-table = "^7.1.1"
sea-orm = { version = "1.1.0", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] }
indoc = "2.0.5"
bech32 = "^0.9.1"
sha2 = "0.10.8"
secp256k1 = { version = "0.28.2", features = ["rand", "recovery"] }
url = "2.5.0"
# crypto
scrypt = { version = "^0.11", default-features = false } # for old-style key generation
......
......@@ -8,6 +8,7 @@ pub mod expire;
pub mod identity;
pub mod net_test;
pub mod oneshot;
pub mod profile;
pub mod publish;
pub mod revocation;
pub mod runtime;
......
This diff is collapsed.
......@@ -15,6 +15,8 @@ pub struct Config {
/// user address
/// to perform actions, user must provide secret
pub address: Option<AccountId>,
/// nostr relay endpoint
pub relay: Option<String>,
}
impl std::default::Default for Config {
......@@ -23,6 +25,7 @@ impl std::default::Default for Config {
duniter_endpoint: String::from(data::LOCAL_DUNITER_ENDPOINT),
indexer_endpoint: String::from(data::LOCAL_INDEXER_ENDPOINT),
address: None,
relay: Some(String::from("wss://relay.copylaradio.com")),
}
}
}
......@@ -34,10 +37,16 @@ impl std::fmt::Display for Config {
} else {
"(no address)".to_string()
};
let relay = if let Some(relay) = &self.relay {
relay.clone()
} else {
"(no relay)".to_string()
};
writeln!(f, "Ğcli config")?;
writeln!(f, "duniter endpoint {}", self.duniter_endpoint)?;
writeln!(f, "indexer endpoint {}", self.indexer_endpoint)?;
write!(f, "address {address}")
writeln!(f, "address {address}")?;
write!(f, "nostr relay {relay}")
}
}
......
......@@ -155,6 +155,9 @@ pub enum Subcommand {
/// Key management (import, generate, list...)
#[clap(subcommand)]
Vault(commands::vault::Subcommand),
/// Nostr profile management (get, set...)
#[clap(subcommand)]
Profile(commands::profile::Subcommand),
/// Cesium
#[clap(subcommand, hide = true)]
Cesium(commands::cesium::Subcommand),
......@@ -233,6 +236,7 @@ async fn main() -> Result<(), GcliError> {
Subcommand::Indexer(subcommand) => indexer::handle_command(data, subcommand).await,
Subcommand::Config(subcommand) => conf::handle_command(data, subcommand).await,
Subcommand::Vault(subcommand) => commands::vault::handle_command(data, subcommand).await,
Subcommand::Profile(subcommand) => commands::profile::handle_command(data, subcommand).await,
Subcommand::Cesium(subcommand) => commands::cesium::handle_command(data, subcommand).await,
Subcommand::Publish => commands::publish::handle_command().await,
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment