clean up
This commit is contained in:
53
Cargo.lock
generated
53
Cargo.lock
generated
@@ -4197,7 +4197,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr"
|
name = "nostr"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"base64",
|
"base64",
|
||||||
@@ -4222,7 +4222,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-blossom"
|
name = "nostr-blossom"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"nostr",
|
"nostr",
|
||||||
@@ -4234,7 +4234,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-connect"
|
name = "nostr-connect"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -4248,7 +4248,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-database"
|
name = "nostr-database"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"btreecap",
|
"btreecap",
|
||||||
"flatbuffers",
|
"flatbuffers",
|
||||||
@@ -4259,7 +4259,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-gossip"
|
name = "nostr-gossip"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"nostr",
|
"nostr",
|
||||||
"opaquerr",
|
"opaquerr",
|
||||||
@@ -4268,7 +4268,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-gossip-memory"
|
name = "nostr-gossip-memory"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"lru",
|
"lru",
|
||||||
@@ -4280,7 +4280,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-lmdb"
|
name = "nostr-lmdb"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"flume 0.12.0",
|
"flume 0.12.0",
|
||||||
@@ -4294,7 +4294,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-memory"
|
name = "nostr-memory"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"btreecap",
|
"btreecap",
|
||||||
"nostr",
|
"nostr",
|
||||||
@@ -4305,7 +4305,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-sdk"
|
name = "nostr-sdk"
|
||||||
version = "0.45.0-alpha.6"
|
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 = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"async-wsocket",
|
"async-wsocket",
|
||||||
@@ -9559,38 +9559,3 @@ dependencies = [
|
|||||||
"syn 2.0.119",
|
"syn 2.0.119",
|
||||||
"winnow 1.0.4",
|
"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"
|
|
||||||
|
|||||||
24
Cargo.toml
24
Cargo.toml
@@ -19,14 +19,13 @@ gpui_tokio = { git = "https://github.com/zed-industries/zed" }
|
|||||||
reqwest_client = { git = "https://github.com/zed-industries/zed" }
|
reqwest_client = { git = "https://github.com/zed-industries/zed" }
|
||||||
|
|
||||||
# Nostr
|
# Nostr
|
||||||
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" }
|
||||||
nostr-memory = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" }
|
||||||
nostr-blossom = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-blossom = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" }
|
||||||
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr", branch = "send-bound" }
|
||||||
nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
|
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-sdk = { git = "https://github.com/rust-nostr/nostr" }
|
nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ], branch = "send-bound" }
|
||||||
nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ] }
|
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
anyhow = "1.0.44"
|
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
|
# Use stacker's psm version which may have better WASM support
|
||||||
psm = { git = "https://github.com/rust-lang/stacker", branch = "master" }
|
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]
|
[profile.release]
|
||||||
strip = true
|
strip = true
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::future::Future;
|
||||||
|
use std::pin::Pin;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
||||||
use nostr_connect::client::AuthUrlHandler;
|
use nostr_connect::client::AuthUrlHandler;
|
||||||
@@ -60,21 +62,23 @@ impl UniversalSigner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trait InnerSigner: fmt::Debug + Send + Sync + 'static {
|
trait InnerSigner: fmt::Debug + Send + Sync + 'static {
|
||||||
fn get_public_key_async(&self) -> BoxedFuture<'_, Result<PublicKey, UniversalSignerError>>;
|
fn get_public_key_async(
|
||||||
|
&self,
|
||||||
|
) -> Pin<Box<dyn Future<Output = Result<PublicKey, UniversalSignerError>> + Send + '_>>;
|
||||||
fn sign_event_async(
|
fn sign_event_async(
|
||||||
&self,
|
&self,
|
||||||
unsigned: UnsignedEvent,
|
unsigned: UnsignedEvent,
|
||||||
) -> BoxedFuture<'_, Result<Event, UniversalSignerError>>;
|
) -> Pin<Box<dyn Future<Output = Result<Event, UniversalSignerError>> + Send + '_>>;
|
||||||
fn nip44_encrypt_async<'a>(
|
fn nip44_encrypt_async<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
content: &'a str,
|
content: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, UniversalSignerError>>;
|
) -> Pin<Box<dyn Future<Output = Result<String, UniversalSignerError>> + Send + 'a>>;
|
||||||
fn nip44_decrypt_async<'a>(
|
fn nip44_decrypt_async<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
payload: &'a str,
|
payload: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, UniversalSignerError>>;
|
) -> Pin<Box<dyn Future<Output = Result<String, UniversalSignerError>> + Send + 'a>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -87,7 +91,9 @@ where
|
|||||||
<T as AsyncSignEvent>::Error: Error + Send + Sync + 'static,
|
<T as AsyncSignEvent>::Error: Error + Send + Sync + 'static,
|
||||||
<T as AsyncNip44>::Error: Error + Send + Sync + 'static,
|
<T as AsyncNip44>::Error: Error + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
fn get_public_key_async(&self) -> BoxedFuture<'_, Result<PublicKey, UniversalSignerError>> {
|
fn get_public_key_async(
|
||||||
|
&self,
|
||||||
|
) -> Pin<Box<dyn Future<Output = Result<PublicKey, UniversalSignerError>> + Send + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
AsyncGetPublicKey::get_public_key_async(&self.0)
|
AsyncGetPublicKey::get_public_key_async(&self.0)
|
||||||
.await
|
.await
|
||||||
@@ -98,7 +104,7 @@ where
|
|||||||
fn sign_event_async(
|
fn sign_event_async(
|
||||||
&self,
|
&self,
|
||||||
unsigned: UnsignedEvent,
|
unsigned: UnsignedEvent,
|
||||||
) -> BoxedFuture<'_, Result<Event, UniversalSignerError>> {
|
) -> Pin<Box<dyn Future<Output = Result<Event, UniversalSignerError>> + Send + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
AsyncSignEvent::sign_event_async(&self.0, unsigned)
|
AsyncSignEvent::sign_event_async(&self.0, unsigned)
|
||||||
.await
|
.await
|
||||||
@@ -110,7 +116,7 @@ where
|
|||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
content: &'a str,
|
content: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, UniversalSignerError>> {
|
) -> Pin<Box<dyn Future<Output = Result<String, UniversalSignerError>> + Send + 'a>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
AsyncNip44::nip44_encrypt_async(&self.0, public_key, content)
|
AsyncNip44::nip44_encrypt_async(&self.0, public_key, content)
|
||||||
.await
|
.await
|
||||||
@@ -122,7 +128,7 @@ where
|
|||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
payload: &'a str,
|
payload: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, UniversalSignerError>> {
|
) -> Pin<Box<dyn Future<Output = Result<String, UniversalSignerError>> + Send + 'a>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
AsyncNip44::nip44_decrypt_async(&self.0, public_key, payload)
|
AsyncNip44::nip44_decrypt_async(&self.0, public_key, payload)
|
||||||
.await
|
.await
|
||||||
@@ -142,7 +148,9 @@ impl UniversalSigner {
|
|||||||
impl AsyncGetPublicKey for UniversalSigner {
|
impl AsyncGetPublicKey for UniversalSigner {
|
||||||
type Error = UniversalSignerError;
|
type Error = UniversalSignerError;
|
||||||
|
|
||||||
fn get_public_key_async(&self) -> BoxedFuture<'_, Result<PublicKey, Self::Error>> {
|
fn get_public_key_async(
|
||||||
|
&self,
|
||||||
|
) -> Pin<Box<dyn Future<Output = Result<PublicKey, Self::Error>> + Send + '_>> {
|
||||||
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
||||||
Box::pin(async move { inner.get_public_key_async().await })
|
Box::pin(async move { inner.get_public_key_async().await })
|
||||||
}
|
}
|
||||||
@@ -154,7 +162,7 @@ impl AsyncSignEvent for UniversalSigner {
|
|||||||
fn sign_event_async(
|
fn sign_event_async(
|
||||||
&self,
|
&self,
|
||||||
unsigned: UnsignedEvent,
|
unsigned: UnsignedEvent,
|
||||||
) -> BoxedFuture<'_, Result<Event, Self::Error>> {
|
) -> Pin<Box<dyn Future<Output = Result<Event, Self::Error>> + Send + '_>> {
|
||||||
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
||||||
Box::pin(async move { inner.sign_event_async(unsigned).await })
|
Box::pin(async move { inner.sign_event_async(unsigned).await })
|
||||||
}
|
}
|
||||||
@@ -167,7 +175,7 @@ impl AsyncNip44 for UniversalSigner {
|
|||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
content: &'a str,
|
content: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, Self::Error>> {
|
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'a>> {
|
||||||
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
||||||
Box::pin(async move { inner.nip44_encrypt_async(public_key, content).await })
|
Box::pin(async move { inner.nip44_encrypt_async(public_key, content).await })
|
||||||
}
|
}
|
||||||
@@ -176,7 +184,7 @@ impl AsyncNip44 for UniversalSigner {
|
|||||||
&'a self,
|
&'a self,
|
||||||
public_key: &'a PublicKey,
|
public_key: &'a PublicKey,
|
||||||
payload: &'a str,
|
payload: &'a str,
|
||||||
) -> BoxedFuture<'a, Result<String, Self::Error>> {
|
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'a>> {
|
||||||
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
let inner = self.inner.read().expect("RwLock poisoned").clone();
|
||||||
Box::pin(async move { inner.nip44_decrypt_async(public_key, payload).await })
|
Box::pin(async move { inner.nip44_decrypt_async(public_key, payload).await })
|
||||||
}
|
}
|
||||||
@@ -186,8 +194,10 @@ impl AsyncNip44 for UniversalSigner {
|
|||||||
pub struct CoopAuthUrlHandler;
|
pub struct CoopAuthUrlHandler;
|
||||||
|
|
||||||
impl AuthUrlHandler for CoopAuthUrlHandler {
|
impl AuthUrlHandler for CoopAuthUrlHandler {
|
||||||
#[allow(mismatched_lifetime_syntaxes)]
|
fn on_auth_url(
|
||||||
fn on_auth_url(&self, auth_url: Url) -> BoxedFuture<Result<(), nostr_connect::error::Error>> {
|
&self,
|
||||||
|
auth_url: Url,
|
||||||
|
) -> Pin<Box<dyn Future<Output = Result<(), nostr_connect::error::Error>> + Send + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
webbrowser::open(auth_url.as_str()).unwrap();
|
webbrowser::open(auth_url.as_str()).unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ regex = "1"
|
|||||||
lsp-types = "0.97.0"
|
lsp-types = "0.97.0"
|
||||||
ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] }
|
ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] }
|
||||||
sum_tree = { git = "https://github.com/zed-industries/zed" }
|
sum_tree = { git = "https://github.com/zed-industries/zed" }
|
||||||
tree-sitter = "0.26"
|
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
smol.workspace = true
|
smol.workspace = true
|
||||||
|
tree-sitter = "0.26"
|
||||||
|
|||||||
Reference in New Issue
Block a user