feat: sprout-pair-relay — ephemeral sidecar for NIP-AB device pairing (#467)

This commit is contained in:
tlongwell-block
2026-05-03 21:07:36 -04:00
committed by GitHub
parent d57e03f315
commit 15bd9ba2ac
6 changed files with 2518 additions and 0 deletions
Generated
+18
View File
@@ -3837,6 +3837,24 @@ dependencies = [
"tracing",
]
[[package]]
name = "sprout-pair-relay"
version = "0.1.0"
dependencies = [
"futures-util",
"http-body-util",
"hyper",
"hyper-util",
"parking_lot",
"rand 0.8.5",
"secp256k1",
"serde_json",
"sha2 0.10.9",
"tokio",
"tokio-tungstenite",
"tokio-util",
]
[[package]]
name = "sprout-pairing-cli"
version = "0.1.0"
+1
View File
@@ -20,6 +20,7 @@ members = [
"crates/sprout-persona",
"crates/git-credential-nostr",
"crates/git-sign-nostr",
"crates/sprout-pair-relay",
]
exclude = ["desktop/src-tauri"]
resolver = "2"
+36
View File
@@ -0,0 +1,36 @@
[package]
name = "sprout-pair-relay"
description = "Ephemeral sidecar relay for NIP-AB device pairing handshakes"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
[lib]
name = "sprout_pair_relay"
path = "src/lib.rs"
[[bin]]
name = "sprout-pair-relay"
path = "src/main.rs"
[dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "net", "time", "sync"] }
tokio-tungstenite = { workspace = true }
serde_json = { workspace = true }
futures-util = { workspace = true }
tokio-util = { workspace = true }
parking_lot = "0.12"
hyper = { version = "1", features = ["server", "http1"] }
hyper-util = { version = "0.1", features = ["tokio"] }
http-body-util = "0.1"
secp256k1 = { version = "0.29", features = ["global-context"] }
sha2 = "0.10"
[dev-dependencies]
tokio = { workspace = true, features = ["test-util"] }
tokio-tungstenite = { workspace = true }
secp256k1 = { version = "0.29", features = ["global-context", "rand-std"] }
sha2 = "0.10"
rand = "0.8"
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
use std::net::SocketAddr;
use std::sync::Arc;
use sprout_pair_relay::{run_server, Relay};
use tokio::net::TcpListener;
#[tokio::main]
async fn main() {
let addr: SocketAddr = ([127, 0, 0, 1], 5000).into();
let listener = match TcpListener::bind(addr).await {
Ok(l) => l,
Err(e) => {
eprintln!("fatal: failed to bind {addr}: {e}");
std::process::exit(1);
}
};
let relay = Arc::new(Relay::new());
run_server(listener, relay).await;
}
File diff suppressed because it is too large Load Diff