diff --git a/Cargo.lock b/Cargo.lock index be5588e..d6c2684 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4197,7 +4197,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "nostr" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "aes", "base64", @@ -4222,7 +4222,7 @@ dependencies = [ [[package]] name = "nostr-blossom" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "base64", "nostr", @@ -4234,7 +4234,7 @@ dependencies = [ [[package]] name = "nostr-connect" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "async-utility", "futures-core", @@ -4248,7 +4248,7 @@ dependencies = [ [[package]] name = "nostr-database" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "btreecap", "flatbuffers", @@ -4259,7 +4259,7 @@ dependencies = [ [[package]] name = "nostr-gossip" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "nostr", "opaquerr", @@ -4268,7 +4268,7 @@ dependencies = [ [[package]] name = "nostr-gossip-memory" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "indexmap", "lru", @@ -4280,7 +4280,7 @@ dependencies = [ [[package]] name = "nostr-lmdb" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "async-utility", "flume 0.12.0", @@ -4294,7 +4294,7 @@ dependencies = [ [[package]] name = "nostr-memory" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "btreecap", "nostr", @@ -4305,7 +4305,7 @@ dependencies = [ [[package]] name = "nostr-sdk" version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr#77df10e45437ae60f09f99d034d28109d86eb09a" +source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" dependencies = [ "async-utility", "async-wsocket", @@ -9559,38 +9559,3 @@ dependencies = [ "syn 2.0.119", "winnow 1.0.4", ] - -[[patch.unused]] -name = "nostr" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-blossom" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-connect" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-gossip-memory" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-lmdb" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-memory" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" - -[[patch.unused]] -name = "nostr-sdk" -version = "0.45.0-alpha.6" -source = "git+https://github.com/rust-nostr/nostr?branch=send-bound#edf9ab4b523af6c969b1f0ca36cbc9486cc21ac6" diff --git a/Cargo.toml b/Cargo.toml index 9bd865e..5475b0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,14 +19,13 @@ gpui_tokio = { git = "https://github.com/zed-industries/zed" } reqwest_client = { git = "https://github.com/zed-industries/zed" } # Nostr -nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" } -nostr-memory = { git = "https://github.com/rust-nostr/nostr" } -nostr-blossom = { git = "https://github.com/rust-nostr/nostr" } -nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" } -nostr-connect = { git = "https://github.com/rust-nostr/nostr" } - -nostr-sdk = { git = "https://github.com/rust-nostr/nostr" } -nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ] } +nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr-blossom = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr-connect = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr-sdk = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } +nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ], branch = "send-bound" } # Others anyhow = "1.0.44" @@ -50,15 +49,6 @@ errno = { version = "0.3.14", default-features = false } # Use stacker's psm version which may have better WASM support psm = { git = "https://github.com/rust-lang/stacker", branch = "master" } -# Use send-bound branch for all nostr crates -nostr = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-sdk = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-blossom = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } -nostr-connect = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" } - [profile.release] strip = true opt-level = "z" diff --git a/crates/state/src/signer.rs b/crates/state/src/signer.rs index c3e78fd..cf9a2bf 100644 --- a/crates/state/src/signer.rs +++ b/crates/state/src/signer.rs @@ -1,5 +1,7 @@ use std::error::Error; use std::fmt; +use std::future::Future; +use std::pin::Pin; use std::sync::{Arc, RwLock}; use nostr_connect::client::AuthUrlHandler; @@ -60,21 +62,23 @@ impl UniversalSigner { } trait InnerSigner: fmt::Debug + Send + Sync + 'static { - fn get_public_key_async(&self) -> BoxedFuture<'_, Result>; + fn get_public_key_async( + &self, + ) -> Pin> + Send + '_>>; fn sign_event_async( &self, unsigned: UnsignedEvent, - ) -> BoxedFuture<'_, Result>; + ) -> Pin> + Send + '_>>; fn nip44_encrypt_async<'a>( &'a self, public_key: &'a PublicKey, content: &'a str, - ) -> BoxedFuture<'a, Result>; + ) -> Pin> + Send + 'a>>; fn nip44_decrypt_async<'a>( &'a self, public_key: &'a PublicKey, payload: &'a str, - ) -> BoxedFuture<'a, Result>; + ) -> Pin> + Send + 'a>>; } #[derive(Debug)] @@ -87,7 +91,9 @@ where ::Error: Error + Send + Sync + 'static, ::Error: Error + Send + Sync + 'static, { - fn get_public_key_async(&self) -> BoxedFuture<'_, Result> { + fn get_public_key_async( + &self, + ) -> Pin> + Send + '_>> { Box::pin(async move { AsyncGetPublicKey::get_public_key_async(&self.0) .await @@ -98,7 +104,7 @@ where fn sign_event_async( &self, unsigned: UnsignedEvent, - ) -> BoxedFuture<'_, Result> { + ) -> Pin> + Send + '_>> { Box::pin(async move { AsyncSignEvent::sign_event_async(&self.0, unsigned) .await @@ -110,7 +116,7 @@ where &'a self, public_key: &'a PublicKey, content: &'a str, - ) -> BoxedFuture<'a, Result> { + ) -> Pin> + Send + 'a>> { Box::pin(async move { AsyncNip44::nip44_encrypt_async(&self.0, public_key, content) .await @@ -122,7 +128,7 @@ where &'a self, public_key: &'a PublicKey, payload: &'a str, - ) -> BoxedFuture<'a, Result> { + ) -> Pin> + Send + 'a>> { Box::pin(async move { AsyncNip44::nip44_decrypt_async(&self.0, public_key, payload) .await @@ -142,7 +148,9 @@ impl UniversalSigner { impl AsyncGetPublicKey for UniversalSigner { type Error = UniversalSignerError; - fn get_public_key_async(&self) -> BoxedFuture<'_, Result> { + fn get_public_key_async( + &self, + ) -> Pin> + Send + '_>> { let inner = self.inner.read().expect("RwLock poisoned").clone(); Box::pin(async move { inner.get_public_key_async().await }) } @@ -154,7 +162,7 @@ impl AsyncSignEvent for UniversalSigner { fn sign_event_async( &self, unsigned: UnsignedEvent, - ) -> BoxedFuture<'_, Result> { + ) -> Pin> + Send + '_>> { let inner = self.inner.read().expect("RwLock poisoned").clone(); Box::pin(async move { inner.sign_event_async(unsigned).await }) } @@ -167,7 +175,7 @@ impl AsyncNip44 for UniversalSigner { &'a self, public_key: &'a PublicKey, content: &'a str, - ) -> BoxedFuture<'a, Result> { + ) -> Pin> + Send + 'a>> { let inner = self.inner.read().expect("RwLock poisoned").clone(); Box::pin(async move { inner.nip44_encrypt_async(public_key, content).await }) } @@ -176,7 +184,7 @@ impl AsyncNip44 for UniversalSigner { &'a self, public_key: &'a PublicKey, payload: &'a str, - ) -> BoxedFuture<'a, Result> { + ) -> Pin> + Send + 'a>> { let inner = self.inner.read().expect("RwLock poisoned").clone(); Box::pin(async move { inner.nip44_decrypt_async(public_key, payload).await }) } @@ -186,8 +194,10 @@ impl AsyncNip44 for UniversalSigner { pub struct CoopAuthUrlHandler; impl AuthUrlHandler for CoopAuthUrlHandler { - #[allow(mismatched_lifetime_syntaxes)] - fn on_auth_url(&self, auth_url: Url) -> BoxedFuture> { + fn on_auth_url( + &self, + auth_url: Url, + ) -> Pin> + Send + '_>> { Box::pin(async move { webbrowser::open(auth_url.as_str()).unwrap(); Ok(()) diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 0ee2e24..921d37a 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -21,7 +21,7 @@ regex = "1" lsp-types = "0.97.0" ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] } sum_tree = { git = "https://github.com/zed-industries/zed" } -tree-sitter = "0.26" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] smol.workspace = true +tree-sitter = "0.26"