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

@diap/sdk

v0.1.10

Published

DIAP TypeScript SDK - Decentralized Intelligent Agent Protocol

Readme

DIAP TypeScript SDK

基于零知识证明的去中心化智能体身份协议 TypeScript SDK。

这是 DIAP Rust SDK 的 TypeScript 翻译版本,保持相同的功能逻辑和 API 设计,但使用 TypeScript/Node.js 生态系统的依赖。

功能特性

  • 🔐 密钥管理:Ed25519 密钥对生成、存储和管理
  • 🌐 IPFS 集成:轻量级 Helia 客户端,支持文件上传和检索
  • 🆔 DID 构建:符合 W3C 规范的 DID 文档构建和发布
  • 🔒 零知识证明:基于 snarkjs 的 ZKP 证明生成和验证
  • 🤖 智能体认证:完整的身份注册和验证流程
  • 🌍 libp2p 网络:点对点网络通信支持

安装

npm install @diap/sdk

Node.js 版本要求

  • Node.js >= 18.0.0

Windows 用户注意事项

如果在 Windows 上遇到安装问题,请参考 INSTALL.md 获取详细的解决方案。

推荐使用以下命令安装:

npm install --legacy-peer-deps

快速开始

import { AgentAuthManager, KeyManager } from '@diap/sdk';

async function main() {
  // 创建认证管理器
  const authManager = await AgentAuthManager.new();

  // 创建智能体
  const { agentInfo, keypair, peerId } = authManager.createAgent('MyAgent');

  // 注册身份
  const registration = await authManager.registerAgent(agentInfo, keypair, peerId);
  console.log('Agent registered:', registration.did);
  console.log('CID:', registration.cid);
}

main().catch(console.error);

API 概览

密钥管理

import { KeyManager } from '@diap/sdk';

// 生成密钥对
const keypair = KeyManager.generate();
console.log('DID:', keypair.did);

// 签名
const message = new TextEncoder().encode('Hello DIAP');
const signature = await KeyManager.sign(keypair, message);

// 验证
const isValid = await KeyManager.verify(keypair, message, signature);

ZKP 证明

import { UniversalNoirManager } from '@diap/sdk';

const manager = await UniversalNoirManager.new();
const info = manager.getBackendInfo();
console.log('Backend:', info.backendType);

配置管理

import { ConfigManager, getDefaultConfig } from '@diap/sdk';

const config = getDefaultConfig();
const manager = await ConfigManager.load();

IPFS 多节点发布

SDK 支持多节点 IPNS 发布,可结合本地节点和云服务实现高可用。

本地节点

import { createMultiPublisher } from '@diap/sdk';

const publisher = await createMultiPublisher('my-key');
const result = await publisher.publishMultiNode('Qm...');

console.log('IPNS Name:', result.ipnsName);
console.log('Published to:', result.publishedNodes);
console.log('Failed:', result.failedNodes);

Pinata

import { createPinataPublisher } from '@diap/sdk';

const publisher = await createPinataPublisher(
  'my-key',
  'PINATA_API_KEY',
  'PINATA_SECRET_KEY'
);

const result = await publisher.publishMultiNode('Qm...');

Infura

import { createInfuraPublisher } from '@diap/sdk';

const publisher = await createInfuraPublisher(
  'my-key',
  'INFURA_PROJECT_ID',
  'INFURA_PROJECT_SECRET'
);

const result = await publisher.publishMultiNode('Qm...');

Web3.Storage

import { createWeb3StoragePublisher } from '@diap/sdk';

const publisher = await createWeb3StoragePublisher(
  'my-key',
  'WEB3_STORAGE_TOKEN'
);

const result = await publisher.publishMultiNode('Qm...');

自定义网关

import { createCustomPublisher } from '@diap/sdk';

const publisher = await createCustomPublisher(
  'my-key',
  'https://your-gateway.com/api/v0',
  'https://your-gateway.com',
  { Authorization: 'Bearer YOUR_TOKEN' }
);

const result = await publisher.publishMultiNode('Qm...');

开发

# 安装依赖
npm install

# 构建项目
npm run build

# 运行测试
npm test

# 代码检查
npm run lint

# 格式化代码
npm run format

文档

详细文档请参考:

许可证

MIT License

链接