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

wip

parent 027f0655
No related branches found
No related tags found
No related merge requests found
Pipeline #40089 passed
...@@ -1587,6 +1587,12 @@ dependencies = [ ...@@ -1587,6 +1587,12 @@ dependencies = [
"parking_lot_core", "parking_lot_core",
] ]
[[package]]
name = "data-encoding"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
[[package]] [[package]]
name = "der" name = "der"
version = "0.7.9" version = "0.7.9"
...@@ -2361,12 +2367,16 @@ dependencies = [ ...@@ -2361,12 +2367,16 @@ dependencies = [
"rstest", "rstest",
"scrypt", "scrypt",
"sea-orm", "sea-orm",
"secp256k1",
"serde", "serde",
"serde_json", "serde_json",
"sha2 0.10.8",
"sp-core", "sp-core",
"sp-runtime", "sp-runtime",
"subxt", "subxt",
"tokio", "tokio",
"tokio-tungstenite",
"url",
] ]
[[package]] [[package]]
...@@ -5172,6 +5182,7 @@ version = "0.28.2" ...@@ -5172,6 +5182,7 @@ version = "0.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10"
dependencies = [ dependencies = [
"rand",
"secp256k1-sys", "secp256k1-sys",
] ]
...@@ -6742,6 +6753,22 @@ dependencies = [ ...@@ -6742,6 +6753,22 @@ dependencies = [
"tokio", "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]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.12" version = "0.7.12"
...@@ -6969,6 +6996,27 @@ version = "0.2.5" ...@@ -6969,6 +6996,27 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 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]] [[package]]
name = "twox-hash" name = "twox-hash"
version = "1.6.3" version = "1.6.3"
...@@ -7114,6 +7162,12 @@ dependencies = [ ...@@ -7114,6 +7162,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "utf-8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]] [[package]]
name = "utf8parse" name = "utf8parse"
version = "0.2.2" version = "0.2.2"
......
...@@ -35,16 +35,21 @@ hex = "^0.4.3" ...@@ -35,16 +35,21 @@ hex = "^0.4.3"
log = "^0.4.22" log = "^0.4.22"
reqwest = { version = "^0.11.27", default-features = false, features = [ reqwest = { version = "^0.11.27", default-features = false, features = [
"rustls-tls", "rustls-tls",
"json",
] } ] }
inquire = "^0.7.5" inquire = "^0.7.5"
serde = { version = "^1.0", features = ["derive"] } serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0.128" serde_json = "^1.0.128"
tokio = { version = "^1.40.0", features = ["macros"] } tokio = { version = "^1.40.0", features = ["macros", "time"] }
tokio-tungstenite = { version = "0.21.0", features = ["rustls-tls-webpki-roots"] }
url = "2.5.0"
confy = "^0.5.1" confy = "^0.5.1"
bs58 = "^0.5.1" bs58 = "^0.5.1"
directories = "^5.0.1" directories = "^5.0.1"
comfy-table = "^7.1.1" comfy-table = "^7.1.1"
sea-orm = { version = "1.1.0", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] } sea-orm = { version = "1.1.0", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] }
sha2 = "0.10.8"
secp256k1 = { version = "0.28.2", features = ["rand", "recovery"] }
# crypto # crypto
scrypt = { version = "^0.11", default-features = false } # for old-style key generation scrypt = { version = "^0.11", default-features = false } # for old-style key generation
......
...@@ -8,6 +8,7 @@ pub mod expire; ...@@ -8,6 +8,7 @@ pub mod expire;
pub mod identity; pub mod identity;
pub mod net_test; pub mod net_test;
pub mod oneshot; pub mod oneshot;
pub mod profile;
pub mod publish; pub mod publish;
pub mod revocation; pub mod revocation;
pub mod runtime; pub mod runtime;
......
This diff is collapsed.
use crate::*; use crate::*;
#[cfg(any(feature = "dev", feature = "gdev"))] // find how to get runtime calls #[cfg(feature = "gdev")] // find how to get runtime calls
type Call = runtime::runtime_types::gdev_runtime::RuntimeCall; type Call = runtime::runtime_types::gdev_runtime::RuntimeCall;
type BalancesCall = runtime::runtime_types::pallet_balances::pallet::Call; type BalancesCall = runtime::runtime_types::pallet_balances::pallet::Call;
......
...@@ -169,7 +169,7 @@ pub fn decrypt(input: &[u8], passphrase: String) -> Result<Vec<u8>, age::Decrypt ...@@ -169,7 +169,7 @@ pub fn decrypt(input: &[u8], passphrase: String) -> Result<Vec<u8>, age::Decrypt
pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliError> { pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliError> {
let db = data.connect_db(); let db = data.connect_db();
// match subcommand #[allow(deprecated)]
match command { match command {
Subcommand::List(choice) => match choice { Subcommand::List(choice) => match choice {
ListChoice::All { show_g1v1 } => { ListChoice::All { show_g1v1 } => {
......
...@@ -15,6 +15,8 @@ pub struct Config { ...@@ -15,6 +15,8 @@ pub struct Config {
/// user address /// user address
/// to perform actions, user must provide secret /// to perform actions, user must provide secret
pub address: Option<AccountId>, pub address: Option<AccountId>,
/// nostr relay endpoint
pub relay: Option<String>,
} }
impl std::default::Default for Config { impl std::default::Default for Config {
...@@ -23,6 +25,7 @@ impl std::default::Default for Config { ...@@ -23,6 +25,7 @@ impl std::default::Default for Config {
duniter_endpoint: String::from(data::LOCAL_DUNITER_ENDPOINT), duniter_endpoint: String::from(data::LOCAL_DUNITER_ENDPOINT),
indexer_endpoint: String::from(data::LOCAL_INDEXER_ENDPOINT), indexer_endpoint: String::from(data::LOCAL_INDEXER_ENDPOINT),
address: None, address: None,
relay: Some(String::from("wss://relay.damus.io")),
} }
} }
} }
...@@ -34,10 +37,16 @@ impl std::fmt::Display for Config { ...@@ -34,10 +37,16 @@ impl std::fmt::Display for Config {
} else { } else {
"(no address)".to_string() "(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, "Ğcli config")?;
writeln!(f, "duniter endpoint {}", self.duniter_endpoint)?; writeln!(f, "duniter endpoint {}", self.duniter_endpoint)?;
writeln!(f, "indexer endpoint {}", self.indexer_endpoint)?; writeln!(f, "indexer endpoint {}", self.indexer_endpoint)?;
write!(f, "address {address}") writeln!(f, "address {address}")?;
write!(f, "nostr relay {relay}")
} }
} }
......
...@@ -149,6 +149,9 @@ pub enum Subcommand { ...@@ -149,6 +149,9 @@ pub enum Subcommand {
/// Key management (import, generate, list...) /// Key management (import, generate, list...)
#[clap(subcommand)] #[clap(subcommand)]
Vault(commands::vault::Subcommand), Vault(commands::vault::Subcommand),
/// Nostr profile management (get, set...)
#[clap(subcommand)]
Profile(commands::profile::Subcommand),
/// Cesium /// Cesium
#[clap(subcommand, hide = true)] #[clap(subcommand, hide = true)]
Cesium(commands::cesium::Subcommand), Cesium(commands::cesium::Subcommand),
...@@ -190,6 +193,7 @@ async fn main() -> Result<(), GcliError> { ...@@ -190,6 +193,7 @@ async fn main() -> Result<(), GcliError> {
Subcommand::Indexer(subcommand) => indexer::handle_command(data, subcommand).await, Subcommand::Indexer(subcommand) => indexer::handle_command(data, subcommand).await,
Subcommand::Config(subcommand) => conf::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::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::Cesium(subcommand) => commands::cesium::handle_command(data, subcommand).await,
Subcommand::Publish => commands::publish::handle_command().await, Subcommand::Publish => commands::publish::handle_command().await,
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment