1
0
forked from GRIN/grim

1 Commits

Author SHA1 Message Date
2ro 9faae5722e Remove dead nip05::transfer client fn
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 <noreply@anthropic.com>
2026-06-17 21:08:05 -04:00
-42
View File
@@ -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::<Value>(&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('/');