feat: auto-generate Nostr keypair during identity creation

Every new identity now gets both Ed25519 (DID) and secp256k1 (Nostr)
keys from creation. The create() method calls create_nostr_key()
automatically, so identity.create RPC always returns nostr_pubkey
and nostr_npub fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-12 22:41:21 +00:00
parent 701b202b41
commit e1d723b24e
2 changed files with 8 additions and 11 deletions

View File

@@ -143,18 +143,15 @@ impl IdentityManager {
self.set_default(&id).await?;
}
// Auto-generate Nostr keypair so every identity has both key types
let _ = self.create_nostr_key(&id).await;
// Re-read to pick up the Nostr keys
let record = self.get(&id).await?;
tracing::info!("Created identity '{}' ({})", name, purpose);
Ok(IdentityRecord {
id,
name,
purpose,
pubkey_hex,
did,
created_at,
nostr_pubkey: None,
nostr_npub: None,
})
Ok(record)
}
/// Get a single identity by ID (without secret key).