Issue portable Ed25519-backed identities for agents using did:key or did:web. Agents sign payloads to prove identity across services without shared secrets.
W3C Decentralized Identifiers give agents a portable, cryptographic identity that works across services. Instead of an opaque token tied to one KavachOS instance, an agent gets a DID like did:key:z6Mk... backed by an Ed25519 keypair.The agent can prove its identity to any service by signing a payload with its private key. The verifier resolves the DID to get the public key and checks the signature. No shared secrets, no central registry.
DIDs are optional. Regular kv_ bearer tokens work fine for single-service deployments. Use DIDs when agents need to prove identity across organizational boundaries.
const { agentDid, privateKeyJwk } = await kavach.did.generateKey(agent.id);console.log(agentDid.did);// did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK// Store privateKeyJwk securely. It's shown once and never stored in the database.
The private key is returned once and never stored in the database. Only the public key and DID document are persisted. Treat the private key like a bearer token.
A presentation is a signed JWT that bundles an agent’s identity with its capabilities. Use this when an agent needs to prove both who it is and what it can do.