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:
@@ -64,7 +64,7 @@ Install the Android SDK / NDK, then from the repo root:
|
||||
|
||||
## Identity service (`goblin-nip05d`)
|
||||
|
||||
The optional `name` service lives in `goblin-nip05d/` (axum + SQLite) and is deployed at [goblin.st](https://goblin.st). It implements [NIP-05](https://nips.nostr.com/5) resolution, [NIP-98](https://nips.nostr.com/98)-authenticated registration/transfer/release. The wallet is fully usable — and fully anonymous — without it. Avatars aren't stored or served — clients render them from the pubkey (an npub gradient with the username's first letter, else the Grin mark).
|
||||
The optional `name` service lives in `goblin-nip05d/` (axum + SQLite) and is deployed at [goblin.st](https://goblin.st). It implements [NIP-05](https://nips.nostr.com/5) resolution, [NIP-98](https://nips.nostr.com/98)-authenticated registration and release (names are never transferred — on a key rotation you release the old name and re-register, or import your existing identity). The wallet is fully usable — and fully anonymous — without it. Avatars aren't stored or served — clients render them from the pubkey (an npub gradient with the username's first letter, else the Grin mark).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -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('/');
|
||||
|
||||
Reference in New Issue
Block a user