Skip to main content

get_or_create_keypair

Function get_or_create_keypair 

Source
pub fn get_or_create_keypair(agent_id: &str) -> Result<Keypair>
Expand description

Look up the per-agent X25519 Keypair, generating + caching it on first call. Subsequent calls for the same agent_id return clones of the cached entry, so plaintext encrypt + recall + decrypt within a single process always round-trips through the same recipient secret.

§Errors

  • Returns Err only when the internal mutex is poisoned (a callee panic in another thread while the lock was held). This is a process-fatal condition; callers may treat it as such.