Class AgentKeystore

java.lang.Object
ai.badmonkey.agentspaces.identity.AgentKeystore

public final class AgentKeystore extends Object
Persistent agent keys (SPEC §4.2, v0.1.13, TODO-9-10-11 B5), so a subordinate agent keeps its key, and so its attested identity, across restarts. Layout under the configured directory, one directory per peer and agent:
<dir>/<peer-id>/<local-name>/agent.key          Ed25519 PKCS#8, 0600
<dir>/<peer-id>/<local-name>/agent.pub          raw 32 bytes
<dir>/<peer-id>/<local-name>/agent-x25519.key   X25519 PKCS#8, 0600
<dir>/<peer-id>/<local-name>/agent-x25519.pub   raw 32 bytes
The peer level keeps two peers sharing a directory from loading each other's agent keys. Certificates are not stored: the peer re-issues them at start, since the key is what must persist. Agent names are refused, never sanitized, when they could escape the directory.
  • Method Details

    • at

      public static AgentKeystore at(Path directory)
      A keystore rooted at a directory, created on first use.
      Parameters:
      directory - the keystore root
      Returns:
      the keystore
    • signingKeys

      public KeyPair signingKeys(PeerId peer, String localName)
      The agent's Ed25519 signing pair, loaded or minted and persisted.
      Parameters:
      peer - the owning peer
      localName - the agent's local name
      Returns:
      the key pair
    • encryptionKeys

      public KeyPair encryptionKeys(PeerId peer, String localName)
      The agent's X25519 encryption pair (per-agent key wrap, SPEC §11a.2), loaded or minted and persisted.
      Parameters:
      peer - the owning peer
      localName - the agent's local name
      Returns:
      the key pair
    • directory

      public Path directory()
      The keystore root.