npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agentdid/sdk

v0.2.0

Published

TypeScript SDK for creating, signing, and verifying Agent-DIDs based on RFC-001. Decentralized identity for autonomous AI agents with Ed25519 signatures, HTTP Bot Auth, and EVM registry support.

Downloads

267

Readme

@agent-did/sdk

License: Apache-2.0 Node.js TypeScript

Verifiable decentralized identity for autonomous AI agents. Create, sign, resolve, and verify Agent-DIDs based on RFC-001.

SDK en TypeScript para identidad descentralizada verificable de agentes de IA autónomos.


Why Agent-DID?

AI agents operate autonomously — calling APIs, executing tools, coordinating tasks. But how do you verify who an agent is, who controls it, and whether it's been compromised?

Agent-DID solves this with:

  • Decentralized identity (W3C DID-compatible) specifically designed for AI agents
  • Ed25519 cryptographic signatures — deterministic, fast, no entropy vulnerability
  • HTTP Bot Auth — sign and verify HTTP requests (IETF Message Signatures)
  • Privacy by design — model and prompt hashes protect IP without exposure
  • EVM registry — on-chain anchoring and revocation on any EVM chain
  • Universal resolver — HTTP, JSON-RPC, and IPFS with failover and caching

Installation

npm install @agent-did/sdk ethers

Requires Node.js 18+.

Quick Start

import { AgentIdentity } from '@agent-did/sdk';
import { ethers } from 'ethers';

// 1. Create an agent identity
const wallet = new ethers.Wallet(process.env.CREATOR_PRIVATE_KEY!);
const identity = new AgentIdentity({ signer: wallet, network: 'polygon' });

const { document, agentPrivateKey } = await identity.create({
  name: 'SupportBot-X',
  coreModel: 'gpt-4o-mini',
  systemPrompt: 'You are a helpful assistant'
});

// 2. Sign a payload
const payload = 'approve:ticket:123';
const signature = await identity.signMessage(payload, agentPrivateKey);

// 3. Verify — anyone can do this with just the DID
const isValid = await AgentIdentity.verifySignature(document.id, payload, signature);
// true ✓

// 4. Revoke if compromised
await AgentIdentity.revokeDid(document.id);
// All subsequent verifications will fail

Features

| Feature | API | Status | |---|---|---| | Create Agent-DID document | identity.create(params) | ✅ | | Sign messages (Ed25519) | identity.signMessage(payload, key) | ✅ | | Sign HTTP requests (Bot Auth) | identity.signHttpRequest(params) | ✅ | | Verify message signatures | AgentIdentity.verifySignature(did, payload, sig) | ✅ | | Verify HTTP signatures | AgentIdentity.verifyHttpRequestSignature(params) | ✅ | | Resolve DID → document | AgentIdentity.resolve(did) | ✅ | | Revoke DID | AgentIdentity.revokeDid(did) | ✅ | | Update document | AgentIdentity.updateDidDocument(did, patch) | ✅ | | Rotate verification keys | AgentIdentity.rotateVerificationMethod(did) | ✅ | | Document history/audit | AgentIdentity.getDocumentHistory(did) | ✅ | | EVM registry adapter | EvmAgentRegistry + EthersAgentRegistryContractClient | ✅ | | Universal resolver (HTTP/RPC/IPFS) | UniversalResolverClient | ✅ |

EVM Registry Integration

Connect to a real on-chain AgentRegistry contract:

import { EthersAgentRegistryContractClient, EvmAgentRegistry } from '@agent-did/sdk';
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('http://localhost:8545');
const signer = new ethers.Wallet(PRIVATE_KEY, provider);
const contract = new ethers.Contract(REGISTRY_ADDRESS, ABI, signer);

const client = new EthersAgentRegistryContractClient(contract);
const registry = new EvmAgentRegistry(client);

AgentIdentity.setRegistry(registry);

See full example: examples/evm-registry-wiring.ts

Production Resolver

Configure a production-grade resolver with failover and caching:

import { AgentIdentity } from '@agent-did/sdk';

// HTTP resolver with IPFS gateway failover
AgentIdentity.useProductionResolverFromHttp({
  registry: evmRegistry,
  cacheTtlMs: 60_000,
  ipfsGateways: ['https://gateway.pinata.cloud', 'https://ipfs.io'],
  onResolutionEvent: (event) => console.log('Resolution:', event)
});

Minimal did:wba example: examples/did-wba-resolution.js

Production Signer (KMS/HSM)

By default create() generates a local Ed25519 key pair (demo mode). For production, inject an AgentSigner backed by your KMS/HSM/Vault:

import { AgentIdentity, AgentSigner, LocalKeySigner } from '@agentdid/sdk';

// Option A: Use LocalKeySigner (testing / demo)
const [signer, privateKeyHex] = LocalKeySigner.generate();

// Option B: Implement AgentSigner for your KMS
const kmsSigner: AgentSigner = {
  async sign(payload: Uint8Array): Promise<string> { /* call KMS */ },
  async getPublicKey(): Promise<Uint8Array> { /* return pub key */ },
};

const result = await identity.create({
  name: 'ProdBot', coreModel: 'gpt-4o', systemPrompt: '...',
  signer: kmsSigner, // private key never leaves KMS
});

// signMessage & signHttpRequest also accept the signer
const sig = await identity.signMessage('payload', kmsSigner);

When signer is provided, result.agentPrivateKey is empty string — the private key never leaves the signer.

Historical Signature Verification

After key rotation, old keys are marked deactivated (ISO timestamp) but kept in the document. Use verifyHistoricalSignature to verify signatures made with rotated keys:

const valid = await AgentIdentity.verifyHistoricalSignature(
  did, payload, signatureHex, 'did:agent:polygon:0x...#key-1'
);

Anti-Replay (HTTP Signatures)

HTTP signatures include created, expires, and a random nonce. Verifiers SHOULD:

  • Reject signatures where expires < now
  • Reject signatures where created > now + maxSkew (default: 30s)
  • Track seen nonces to prevent replay within the expiration window

Specification

This SDK implements RFC-001: Agent-DID Specification — a standard for decentralized AI agent identity extending W3C DIDs with agent-specific metadata.

Conformance: 11/11 MUST PASS + 5/5 SHOULD PASS

Current Limitations

  • Default resolver is in-memory (not persistent) — use production resolver for real deployments
  • EVM adapter assumes contract exposes registerAgent, revokeAgent, getAgentRecord, isRevoked
  • EVM timestamps consumed as Unix-string, SDK normalizes to ISO-8601

Contributing

See CONTRIBUTING.md

License

Apache-2.0 — see root LICENSE.