kya_generate_keypair
Generate Ed25519 keypairs for signing agent identity cards to establish secure audit trails within safety monitoring systems.
Instructions
Generate an Ed25519 keypair for signing agent identity cards.
Args: name: Key name (default "mcp-session"). Keys stored at ~/.kya/keys/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | mcp-session |
Implementation Reference
- src/agent_safety_mcp/server.py:368-386 (handler)The handler implementation for the `kya_generate_keypair` MCP tool, which generates an Ed25519 keypair and registers the tool using the `@mcp.tool()` decorator.
@mcp.tool() def kya_generate_keypair(name: str = "mcp-session") -> dict: """Generate an Ed25519 keypair for signing agent identity cards. Args: name: Key name (default "mcp-session"). Keys stored at ~/.kya/keys/ """ global _kya_key_name try: priv_path, pub_path = generate_keypair(name) _kya_key_name = name return { "status": "generated", "private_key": str(priv_path), "public_key": str(pub_path), "note": "Use kya_sign_card to sign cards with this key.", } except Exception as e: return {"error": f"Failed to generate keypair: {e}. Install cryptography: pip install cryptography"}