mirror of
https://github.com/block/buzz.git
synced 2026-10-27 20:41:57 +00:00
Update Rust dependencies for pair relay (#534)
This commit is contained in:
705
Cargo.lock
generated
705
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -97,7 +97,7 @@ impl DevMcp {
|
||||
}
|
||||
}
|
||||
|
||||
#[tool_handler]
|
||||
#[tool_handler(router = self.tool_router)]
|
||||
impl ServerHandler for DevMcp {
|
||||
fn get_info(&self) -> ServerInfo {
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
|
||||
|
||||
@@ -3126,7 +3126,7 @@ on send_message to upload and attach in one step."
|
||||
}
|
||||
}
|
||||
|
||||
#[tool_handler]
|
||||
#[tool_handler(router = self.tool_router)]
|
||||
impl ServerHandler for SproutMcpServer {
|
||||
fn get_info(&self) -> ServerInfo {
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
|
||||
|
||||
@@ -25,12 +25,11 @@ 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"] }
|
||||
secp256k1 = { version = "0.31", 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"] }
|
||||
secp256k1 = { version = "0.31", features = ["global-context", "rand", "std"] }
|
||||
sha2 = "0.10"
|
||||
rand = "0.8"
|
||||
|
||||
@@ -44,7 +44,7 @@ use hyper::{Method, Request, Response, StatusCode, Version};
|
||||
use hyper_util::rt::TokioIo;
|
||||
use parking_lot::Mutex;
|
||||
use secp256k1::schnorr::Signature as SchnorrSig;
|
||||
use secp256k1::{Message as SecpMsg, XOnlyPublicKey};
|
||||
use secp256k1::XOnlyPublicKey;
|
||||
use serde_json::Value;
|
||||
use sha2::{Digest, Sha256};
|
||||
use tokio::net::TcpListener;
|
||||
@@ -577,17 +577,16 @@ fn verify_event_sig(ev: &Value) -> Result<(), &'static str> {
|
||||
|
||||
// Step 3: parse pubkey as x-only.
|
||||
let pubkey_bytes = decode_hex32(pubkey_str).ok_or("pubkey must be 64 lowercase hex chars")?;
|
||||
let xonly_pk = XOnlyPublicKey::from_slice(&pubkey_bytes).map_err(|_| "invalid: bad pubkey")?;
|
||||
let xonly_pk =
|
||||
XOnlyPublicKey::from_byte_array(pubkey_bytes).map_err(|_| "invalid: bad pubkey")?;
|
||||
|
||||
// Step 4: parse sig.
|
||||
let sig_bytes = decode_hex64(sig_str).ok_or("sig must be 128 lowercase hex chars")?;
|
||||
let schnorr_sig =
|
||||
SchnorrSig::from_slice(&sig_bytes).map_err(|_| "invalid: bad signature encoding")?;
|
||||
let schnorr_sig = SchnorrSig::from_byte_array(sig_bytes);
|
||||
|
||||
// Step 5: verify.
|
||||
let secp = secp256k1::Secp256k1::verification_only();
|
||||
let msg = SecpMsg::from_digest(hash);
|
||||
secp.verify_schnorr(&schnorr_sig, &msg, &xonly_pk)
|
||||
secp.verify_schnorr(&schnorr_sig, &hash, &xonly_pk)
|
||||
.map_err(|_| "invalid: signature verification failed")
|
||||
}
|
||||
|
||||
@@ -914,6 +913,8 @@ async fn handle_conn(relay: Arc<Relay>, conn_id: u64, stream: WebSocketStream<To
|
||||
// This allows the channel to close when we drop our local tx.
|
||||
relay.remove_sub(conn_id);
|
||||
|
||||
let _ = tx.try_send(OutMsg::Close);
|
||||
|
||||
// Drop the sender so the writer can drain any queued messages (including
|
||||
// Close frames), then cancel after a brief grace period.
|
||||
drop(tx);
|
||||
|
||||
@@ -97,7 +97,7 @@ async fn assert_closed(ws: &mut WS) {
|
||||
/// Generate a random keypair; returns `(SecretKey, pubkey_hex)`.
|
||||
fn gen_keypair() -> (SecretKey, String) {
|
||||
let secp = Secp256k1::new();
|
||||
let (sk, pk) = secp.generate_keypair(&mut secp256k1::rand::rngs::OsRng);
|
||||
let (sk, pk) = secp.generate_keypair(&mut secp256k1::rand::rng());
|
||||
let xonly = pk.x_only_public_key().0;
|
||||
let pubkey_hex = xonly
|
||||
.serialize()
|
||||
@@ -171,10 +171,13 @@ fn make_signed_event(sk: &SecretKey, pubkey_hex: &str, p_hex: &str, nonce: u64)
|
||||
let hash: [u8; 32] = Sha256::digest(commitment_str.as_bytes()).into();
|
||||
let id_hex: String = hash.iter().map(|b| format!("{b:02x}")).collect();
|
||||
|
||||
let msg = secp256k1::Message::from_digest(hash);
|
||||
let keypair = Keypair::from_secret_key(&secp, sk);
|
||||
let sig = secp.sign_schnorr_no_aux_rand(&msg, &keypair);
|
||||
let sig_hex: String = sig.serialize().iter().map(|b| format!("{b:02x}")).collect();
|
||||
let sig = secp.sign_schnorr_no_aux_rand(&hash, &keypair);
|
||||
let sig_hex: String = sig
|
||||
.to_byte_array()
|
||||
.iter()
|
||||
.map(|b| format!("{b:02x}"))
|
||||
.collect();
|
||||
|
||||
json!({
|
||||
"id": id_hex,
|
||||
|
||||
Reference in New Issue
Block a user