mirror of
https://github.com/block/buzz.git
synced 2026-12-01 05:32:24 +00:00
chore: remove LLM-slop comments across the codebase (#1277)
Signed-off-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Mari <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Quinn <96f056ad5f2305c8ddf637dc65d048aa4c12d7daeb8867690e34fca46b0ef64c@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Sami <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Perci <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
This commit is contained in:
@@ -30,8 +30,6 @@ use tokio::time::timeout;
|
||||
use tokio_tungstenite::{connect_async, tungstenite::Message};
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
// ── CLI definition ────────────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "buzz-pair",
|
||||
@@ -72,8 +70,6 @@ enum Cmd {
|
||||
TestVectors,
|
||||
}
|
||||
|
||||
// ── Error type ────────────────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
enum CliError {
|
||||
#[error("pairing error: {0}")]
|
||||
@@ -98,8 +94,6 @@ enum CliError {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
// ── Entry point ───────────────────────────────────────────────────────────────
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let cli = Cli::parse();
|
||||
@@ -117,8 +111,6 @@ async fn run(cmd: Cmd) -> Result<(), CliError> {
|
||||
}
|
||||
}
|
||||
|
||||
// ── source subcommand ─────────────────────────────────────────────────────────
|
||||
|
||||
async fn cmd_source(relay_url: String, nsec: Option<String>) -> Result<(), CliError> {
|
||||
// Resolve the payload to transfer.
|
||||
let (payload_str, payload_type) = resolve_payload(nsec)?;
|
||||
@@ -208,8 +200,6 @@ async fn cmd_source(relay_url: String, nsec: Option<String>) -> Result<(), CliEr
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ── target subcommand ─────────────────────────────────────────────────────────
|
||||
|
||||
async fn cmd_target(relay_override: Option<String>, show_secret: bool) -> Result<(), CliError> {
|
||||
// Read QR URI from stdin.
|
||||
print!("Paste the QR URI: ");
|
||||
@@ -342,8 +332,6 @@ async fn cmd_target(relay_override: Option<String>, show_secret: bool) -> Result
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ── test-vectors subcommand ───────────────────────────────────────────────────
|
||||
|
||||
fn cmd_test_vectors() -> Result<(), CliError> {
|
||||
// Fixed test keys from the NIP-AB spec.
|
||||
let session_secret: [u8; 32] =
|
||||
@@ -409,8 +397,6 @@ fn cmd_test_vectors() -> Result<(), CliError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ── Abort-aware event helpers ─────────────────────────────────────────────────
|
||||
|
||||
/// Check whether `event` is an abort from the peer. If so, transition the
|
||||
/// session and return an error the caller can propagate. Otherwise return
|
||||
/// `Ok(())` so the caller can proceed with its own handler.
|
||||
@@ -423,8 +409,6 @@ fn check_for_abort(session: &mut PairingSession, event: &Event) -> Result<(), Cl
|
||||
}
|
||||
}
|
||||
|
||||
// ── NIP-42 auth helper ────────────────────────────────────────────────────────
|
||||
|
||||
/// Handle NIP-42 authentication if the relay requires it.
|
||||
///
|
||||
/// Uses the pairing session's ephemeral keys to authenticate, ensuring the
|
||||
@@ -502,8 +486,6 @@ fn parse_auth_challenge(text: &str) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
// ── WebSocket helpers ─────────────────────────────────────────────────────────
|
||||
|
||||
/// Publish a Nostr event to the relay.
|
||||
async fn publish_event<S>(write: &mut S, event: &Event) -> Result<(), CliError>
|
||||
where
|
||||
@@ -592,8 +574,6 @@ fn parse_relay_event(text: &str, sub_id: &str) -> Option<Event> {
|
||||
serde_json::from_value(arr[2].clone()).ok()
|
||||
}
|
||||
|
||||
// ── Payload helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
/// Resolve the payload to send.
|
||||
///
|
||||
/// If `nsec` is provided, parse it as bech32 and return the raw nsec string.
|
||||
@@ -617,8 +597,6 @@ fn resolve_payload(nsec: Option<String>) -> Result<(Zeroizing<String>, PayloadTy
|
||||
}
|
||||
}
|
||||
|
||||
// ── I/O helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// Read a single line from stdin (trims trailing newline).
|
||||
fn read_line() -> Result<String, CliError> {
|
||||
let stdin = io::stdin();
|
||||
@@ -636,8 +614,6 @@ fn read_yes_no() -> Result<bool, CliError> {
|
||||
Ok(matches!(line.trim(), "y" | "Y" | "yes" | "Yes" | "YES"))
|
||||
}
|
||||
|
||||
// ── Crypto helpers ────────────────────────────────────────────────────────────
|
||||
|
||||
/// Decode a 64-char hex string into a `[u8; 32]`.
|
||||
fn hex_to_32(s: &str) -> Result<[u8; 32], CliError> {
|
||||
let bytes = hex::decode(s).map_err(|e| CliError::Other(format!("invalid hex '{s}': {e}")))?;
|
||||
|
||||
Reference in New Issue
Block a user