Cryptographic identity primitives for AI agents - Ed25519 keypairs, DIDs, signed envelopes, and provenance entries
Project description
kanoniv-agent-auth
Cryptographic identity and delegation for AI agents. The missing auth layer for MCP.
One library, three languages, byte-identical outputs.
The Problem
MCP servers currently rely on API keys and implicit trust. Any agent can call any tool with no identity, no delegation chain, and no audit trail.
The Solution
Agents carry verifiable authority. Every MCP tool call includes a cryptographic proof that the server verifies - who the agent is, what it's allowed to do, and who granted that authority. No external lookups needed.
Agent Framework (CrewAI, LangGraph, AutoGen, Claude, OpenAI...)
|
v
MCP Tool Call + _proof (delegation chain + signature)
|
v
MCP Server -> verify_mcp_call() -> execute or reject
Install
# Rust
cargo add kanoniv-agent-auth
# TypeScript / JavaScript
npm install @kanoniv/agent-auth
# Python
pip install kanoniv-agent-auth
MCP Server Auth (5 lines)
TypeScript
import { McpProof, verifyMcpCall } from "@kanoniv/agent-auth";
function handleToolCall(args: Record<string, unknown>) {
const { proof, cleanArgs } = McpProof.extract(args);
if (proof) {
const result = verifyMcpCall(proof, rootIdentity);
console.log(`Agent ${result.invoker_did} verified (depth: ${result.depth})`);
}
// use cleanArgs for your tool logic
}
Rust
use kanoniv_agent_auth::mcp::{McpProof, verify_mcp_call};
let (proof, clean_args) = McpProof::extract(&args);
if let Some(proof) = proof {
let result = verify_mcp_call(&proof, &root_identity)?;
println!("Agent {} verified", result.invoker_did);
}
Python
from kanoniv_agent_auth import McpProof, verify_mcp_call, extract_mcp_proof
proof, clean_args = extract_mcp_proof(args_json)
if proof:
invoker_did, root_did, chain, depth = verify_mcp_call(proof, root_identity)
print(f"Agent {invoker_did} verified (depth: {depth})")
Agent Side (attaching proofs to tool calls)
import { generateKeyPair, createRootDelegation, McpProof } from "@kanoniv/agent-auth";
// Human grants agent authority: resolve only, max $5 cost
const root = generateKeyPair();
const agent = generateKeyPair();
const delegation = createRootDelegation(root, agent.identity.did, [
{ type: "action_scope", value: ["resolve", "search"] },
{ type: "max_cost", value: 5.0 },
]);
// Agent creates proof for each tool call
const proof = McpProof.create(agent, "resolve", { source: "crm" }, delegation);
const args = McpProof.inject(proof, { source: "crm", external_id: "123" });
// Send args to MCP server - _proof field is verified automatically
Delegation Chains
Authority flows from root to agent to sub-agent, narrowing at each step:
Root (Human)
|-- delegates to Manager: [resolve, search, merge]
|-- delegates to Worker: [resolve] (narrower)
|-- calls MCP tool with proof
|-- server verifies entire chain back to root
Caveats accumulate - you can only narrow authority, never widen it.
Caveat Types
| Caveat | Description |
|---|---|
action_scope |
Allowed actions (e.g. ["resolve", "search"]) |
expires_at |
RFC 3339 expiry timestamp |
max_cost |
Cost ceiling for the operation |
resource |
Resource glob pattern (e.g. "entity:customer:*") |
context |
Key/value context match (e.g. session_id) |
custom |
Arbitrary key/value constraint |
Auth Modes
MCP servers can choose their enforcement level:
| Mode | Behavior |
|---|---|
required |
Reject calls without valid proof |
optional |
Verify if present, allow unauthenticated |
disabled |
Skip verification |
import { verifyMcpToolCall } from "@kanoniv/agent-auth";
const outcome = verifyMcpToolCall("resolve", args, rootIdentity, "required");
// outcome.verified: VerificationResult | null
// outcome.args: cleaned args (no _proof)
What's Inside
| Primitive | Description |
|---|---|
AgentKeyPair |
Ed25519 keypair generation and persistence |
AgentIdentity |
did:agent: DID derivation and W3C DID Documents |
SignedMessage |
Canonical JSON signing with nonce and timestamp |
Delegation |
Attenuated authority with 6 caveat types |
Invocation |
Exercise delegated authority with proof |
McpProof |
Self-contained proof for MCP transport |
ProvenanceEntry |
Signed audit trail with DAG chaining |
DID Format
did:agent:{hex(sha256(public_key)[..16])}
32-character hex identifier derived from the SHA-256 hash of the Ed25519 public key. W3C DID method registration pending (PR #681).
Cross-Language Interop
All three implementations produce byte-identical:
- DIDs from the same public key
- Canonical JSON for signing
- Content hashes for chaining
- MCP proofs (hex-encoded public keys, deterministic JSON)
The fixtures/ directory contains test vectors generated from a known secret key. Every implementation is tested against these fixtures.
Specification
See spec/AGENT-IDENTITY.md for the formal specification.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kanoniv_agent_auth-0.2.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 484.3 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1c5ba1ca96927ff60b40f48728647a62b867a5a26917a2df4d8ba1d10734b21
|
|
| MD5 |
3aa2dc3cd2f4af38859627287fba142a
|
|
| BLAKE2b-256 |
b8801c971ee1f3fcb6c9c7eafea783634ddb11bf43f466b483ff6cc69365ef84
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 654.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f822dfe9bc95e76eb325367297a3dd87c87795e6de0c2e8a6953c3d5155e74
|
|
| MD5 |
fc491c6afb3a734ea9cd61112a25b044
|
|
| BLAKE2b-256 |
90108ea950540a113b33eb3caf8c817f3e50eaaa0c24c025dfaba7fd6e296f0e
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee1ad55946fd3865bfb67e064d8a6adfb4c270a9f5d25fcdefc5417b9653175
|
|
| MD5 |
0beb4ae79119df9fcda2ab5424e54a39
|
|
| BLAKE2b-256 |
42c9cfac12018e3283a53b97066938787155ed9d4de2fdf47006e822e30c4e9b
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 484.4 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90a67104bc00c9d25dd08d621f97f90f3b3c887f80ef039c7874afcf0d76d892
|
|
| MD5 |
c974800578f27bec8df9a3751568b5ab
|
|
| BLAKE2b-256 |
446d394716442eb030fe0ffd2b7f7506851c997ad00aab0bc9f8418efaa975da
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 654.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5991b8fad64fbc0e638a473e97196487dce30cfeb21813239f8d1bc39579340d
|
|
| MD5 |
3d0f596c3da4dd7bff1045a3a79b1ac1
|
|
| BLAKE2b-256 |
aa6693df61b32fc9fc87fb33e000358cdd2edd7176e0911425f0377016f00a63
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d73aef6886fc3dd8e110aa405527201f148cd9291a872d14c201e5e15d14b5
|
|
| MD5 |
1ca32df9473c1231e95f5e563b1774b2
|
|
| BLAKE2b-256 |
2098458d613bcfcae747f9bcc1a9330f035be6a5e1d915ebcceb1f8ed053a6c4
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 486.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6730197db7bbcb6ca87d17dd7377d71e112f95b135fc21dabb2258ccfbcdb1fc
|
|
| MD5 |
5fb48becb93218e44b9c41c7755f2712
|
|
| BLAKE2b-256 |
a39e4f49980145cad39bfe3c8c4ce86ad199227c0b6d79ec78ccbace6583cbf1
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 658.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f38a909ffc2dd9af1240617fab2b8dd8e1a2ad6e663a75fb1b26cc387a8422e
|
|
| MD5 |
4e6379df032db3d97633f4d576f8d755
|
|
| BLAKE2b-256 |
2a0f36f3ce54e83a1d6ca4bfb92cfa64862fa3c249bdf637c8a6777c0ec3ef99
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7308d7495404cfd496406b4440093d6fa2fd75723a98b0bea385b5ada06cb0c7
|
|
| MD5 |
09e2ded157cc5d2cfd3ad6d1ffc0057b
|
|
| BLAKE2b-256 |
94b4b7d5a24de58efc71ebf91f28f50e059fc178c54ddb4d386107dcdc820be7
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 486.8 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbef2820508973d738bb4c664d0c17e30c3199967bc47ad0f33ae69d7c7fab45
|
|
| MD5 |
cd2f10c4de4fbfd3a21ea22e24948c6d
|
|
| BLAKE2b-256 |
fd2ff51bd0914487fdb17b2ab9dfe573ffa78bd4a114834c9aba5af032cf1f7d
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 658.4 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46460db9cbfd9b059cc93fdcb72aa0847684a5485c6351ef681b127dca6ae2a3
|
|
| MD5 |
659be2154cb585a1c6a1ba00fb8c20d8
|
|
| BLAKE2b-256 |
463639342af8c8062d5a986965dab0b26d3468adcc9ddc7d57203762698cd7d0
|
File details
Details for the file kanoniv_agent_auth-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: kanoniv_agent_auth-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8f1bc520a10157f64a906ff4d8f0044f7e75adeff1b3c1d562e81c0b75366d8
|
|
| MD5 |
90d4ed6a84589592b87cde8457663a75
|
|
| BLAKE2b-256 |
c78df2acc0d22b80d06cb3e1af9326510dd3b7eeeec50e47204046bce25e32f6
|