nip05: drop the name-transfer client — names are never transferred

The name service no longer exposes /api/v1/transfer (removed server-side), and
the model is release-and-reclaim, not transfer: on a key rotation you release
the old name and re-register (or import your existing identity). Removed the dead
nip05::transfer() client fn (it had no callers) and the "transfer" wording in the
README.
This commit is contained in:
2ro
2026-06-17 22:10:35 -04:00
parent 36e63d4751
commit 9262d7429b
2 changed files with 1 additions and 43 deletions
-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('/');