From 9faae5722ec71cd3a494c6ff83b361a0877d7960 Mon Sep 17 00:00:00 2001 From: 2ro <17595647+2ro@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:08:05 -0400 Subject: [PATCH] Remove dead nip05::transfer client fn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Names are bound to the nostr key and are *released* on every key change, never carried across to the new key — that's deliberate (security, anti-squatting, anti-spam). Key rotation calls nip05::unregister (release); nothing ever called nip05::transfer. The name authority is dropping the /api/v1/transfer endpoint to enforce the release-every-time policy structurally, so this client function would only ever hit a 404. Remove it. Co-Authored-By: Claude Opus 4.8 --- src/nostr/nip05.rs | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/src/nostr/nip05.rs b/src/nostr/nip05.rs index d8e1731..47a55cb 100644 --- a/src/nostr/nip05.rs +++ b/src/nostr/nip05.rs @@ -305,48 +305,6 @@ pub async fn register(server: &str, name: &str, keys: &Keys) -> RegisterResult { } } -/// Atomically move an owned name to a new pubkey (key rotation). -/// Signed by the OLD key; the server enforces ownership and the -/// one-name-per-pubkey rule for the target key. -pub async fn transfer( - server: &str, - name: &str, - old_keys: &Keys, - new_pubkey_hex: &str, -) -> Result<(), String> { - let server = server.trim_end_matches('/'); - let url = format!("{}/api/v1/transfer", server); - let body = serde_json::json!({ - "name": name.to_lowercase(), - "new_pubkey": new_pubkey_hex, - }) - .to_string(); - let Some(auth) = nip98_auth(old_keys, &url, "POST", Some(body.as_bytes())) else { - return Err("auth event build failed".to_string()); - }; - let headers = vec![ - ("Authorization".to_string(), auth), - ("Content-Type".to_string(), "application/json".to_string()), - ]; - let Some(resp) = nym::http_request("POST", url, Some(body), headers).await else { - return Err("network unavailable".to_string()); - }; - if resp.contains("\"transferred\":true") { - return Ok(()); - } - let err = serde_json::from_str::(&resp) - .ok() - .and_then(|d| d.get("error").and_then(|e| e.as_str()).map(String::from)) - .unwrap_or_else(|| { - if resp.trim().is_empty() { - "name server does not support transfer yet".to_string() - } else { - format!("unexpected response: {}", resp) - } - }); - Err(err) -} - /// Release a registered name (NIP-98 authed by the owner). pub async fn unregister(server: &str, name: &str, keys: &Keys) -> Result<(), String> { let server = server.trim_end_matches('/');