diap_rs_sdk/
lib.rs

1/**
2 * DIAP Rust SDK - ZKP版本
3 * Decentralized Intelligent Agent Protocol
4 * 使用零知识证明验证DID-CID绑定,无需IPNS
5 */
6
7// ============ 核心模块 ============
8
9// 密钥管理
10pub mod key_manager;
11
12// IPFS客户端
13pub mod ipfs_client;
14
15// 内置IPFS节点管理器(Kubo 特性暂未启用)
16pub mod kubo_installer;
17
18// DID构建器(简化版)
19pub mod did_builder;
20
21// 签名PeerID(隐私保护)
22pub mod encrypted_peer_id;
23// Iroh ID 加密
24pub mod encrypted_iroh_id;
25
26// ZKP模块 (基于Noir)
27
28// 统一身份管理
29pub mod identity_manager;
30
31// Nonce管理器(防重放攻击)
32pub mod nonce_manager;
33
34// DID文档缓存
35pub mod did_cache;
36
37// IPFS Pubsub认证通讯
38pub mod pubsub_authenticator;
39
40// Noir ZKP集成(新版本)
41pub mod noir_verifier;
42pub mod noir_zkp;
43
44// 智能体验证闭环
45pub mod agent_verification;
46
47// IPFS双向验证系统
48pub mod ipfs_bidirectional_verification;
49
50// 智能体认证管理器(统一API)
51pub mod agent_auth;
52
53// ZKP密钥生成器
54pub mod key_generator;
55
56// Iroh节点(预留)
57pub mod iroh_node;
58
59// 配置管理(保留)
60pub mod config_manager;
61
62// ============ 公共导出 ============
63
64// 密钥管理
65pub use key_manager::{KeyBackup, KeyManager, KeyPair};
66
67// IPFS客户端
68pub use ipfs_client::{IpfsClient, IpfsUploadResult, IpnsPublishResult};
69
70// 内置IPFS节点管理器导出(Kubo 特性暂未启用)
71// pub use ipfs_node_manager::{
72//     IpfsNodeManager,
73//     IpfsNodeConfig,
74//     IpfsNodeStatus,
75//     IpfsNodeInfo,
76// };
77
78// Kubo自动安装器
79pub use kubo_installer::KuboInstaller;
80
81// DID构建器
82pub use did_builder::{
83    get_did_document_from_cid, verify_did_document_integrity, DIDBuilder, DIDDocument,
84    DIDPublishResult, Service, VerificationMethod,
85};
86
87// Iroh P2P通信器
88pub mod iroh_communicator;
89
90// Iroh节点
91pub use iroh_node::{IrohConfig, IrohNode};
92
93// 签名PeerID(隐私保护)
94pub use encrypted_peer_id::{
95    decrypt_peer_id_with_secret, encrypt_peer_id, verify_encrypted_peer_id_ownership,
96    verify_peer_id_signature, EncryptedPeerID,
97};
98
99// ZKP模块 (基于Noir)
100
101// 嵌入Noir电路模块
102#[cfg(feature = "embedded-noir")]
103pub mod noir_embedded;
104
105// 通用Noir管理器
106pub mod noir_universal;
107
108// Noir ZKP集成
109pub use noir_zkp::{
110    NoirAgent, NoirProofResult, NoirProverInputs, NoirZKPManager, PerformanceMetrics,
111};
112
113// Noir验证器
114pub use noir_verifier::{ImprovedNoirZKPManager, NoirVerificationResult, NoirVerifier};
115
116// 导出通用管理器
117pub use noir_universal::{BackendInfo, NoirBackend, PerformanceStats, UniversalNoirManager};
118
119// 导出嵌入模块(如果启用)
120#[cfg(feature = "embedded-noir")]
121pub use noir_embedded::{
122    CacheStats as EmbeddedCacheStats, CircuitMetadata, EmbeddedCircuit, EmbeddedNoirZKPManager,
123};
124
125// 智能体验证闭环
126pub use agent_verification::{
127    AgentVerificationManager, AgentVerificationRequest, AgentVerificationResponse,
128    AgentVerificationStatus, CacheStats,
129};
130
131// IPFS双向验证系统
132pub use ipfs_bidirectional_verification::{
133    AgentSession, BidirectionalVerificationResult, IpfsBidirectionalVerificationManager, ProofData,
134    SessionStatus, VerificationChallenge, VerificationResult, VerificationStatus,
135};
136
137// 智能体认证管理器
138pub use agent_auth::{AgentAuthManager, AuthResult, BatchAuthResult};
139
140// ZKP密钥生成器
141pub use key_generator::{ensure_zkp_keys_exist, generate_noir_keys, generate_simple_zkp_keys};
142
143// 身份管理
144pub use identity_manager::{
145    AgentInfo, IdentityManager, IdentityRegistration, IdentityVerification, ServiceInfo,
146};
147
148// 配置管理
149pub use config_manager::{
150    AgentConfig, CacheConfig, DIAPConfig, IpfsConfig, IpnsConfig, LoggingConfig,
151};
152
153// Nonce管理器
154pub use nonce_manager::{NonceManager, NonceRecord};
155
156// DID文档缓存
157pub use did_cache::{CacheEntry, CacheStats as DIDCacheStats, DIDCache};
158
159// Pubsub认证器
160pub use pubsub_authenticator::{
161    AuthenticatedMessage, MessageVerification, PubSubMessageType, PubsubAuthRequestPayload,
162    PubsubAuthResponsePayload, PubsubAuthenticator, TopicConfig, TopicPolicy,
163};
164
165// Iroh P2P通信器
166pub use iroh_communicator::{
167    IrohCommunicator, IrohConfig as IrohCommConfig, IrohConnection, IrohMessage, IrohMessageType,
168};
169
170// ============ 常用类型重导出 ============
171pub use anyhow::Result;
172pub use serde::{Deserialize, Serialize};
173
174// ============ 版本信息 ============
175pub const VERSION: &str = env!("CARGO_PKG_VERSION");
176pub const DESCRIPTION: &str =
177    "DIAP Rust SDK - Noir ZKP版本:基于Noir零知识证明的去中心化智能体身份验证系统";