支付 ID(PID)系统
支付 ID 系统是 Pelago 的去中心化身份层,为安全且私密的支付认证提供支撑。
概述
PID 基于 W3C 去中心化标识符(DID)标准构建,提供:
- 自主权身份:用户自主掌控支付身份
- 可验证凭证:链上声誉与信用评分
- 隐私保护:零知识证明隐藏敏感数据
DID 结构
Pelago DID 遵循标准格式:
did:pelago:network:identifier
示例:
did:pelago:stellar:GBXXX...XXX
DID 文档
每个 PID 都有一个存储在链上的关联 DID 文档:
{
"@context": "https://www.w3.org/ns/did/v1",
"id": "did:pelago:stellar:GBXXX...XXX",
"verificationMethod": [{
"id": "did:pelago:stellar:GBXXX...XXX#key-1",
"type": "Ed25519VerificationKey2020",
"controller": "did:pelago:stellar:GBXXX...XXX",
"publicKeyMultibase": "zH3C2..."
}],
"authentication": ["did:pelago:stellar:GBXXX...XXX#key-1"],
"service": [{
"id": "did:pelago:stellar:GBXXX...XXX#payment",
"type": "PaymentService",
"serviceEndpoint": "https://pay.pelago.tech"
}]
}
可验证凭证
PID 可以持有证明用户属性的可验证凭证:
凭证类型
| 类型 | 签发方 | 用途 |
|---|---|---|
| KYC | Pelago | 身份验证 |
| 信用评分 | 征信机构 | 信用评估 |
| 企业 | 监管机构 | 企业验证 |
| 支付历史 | Pelago | 交易声誉 |
凭证示例
{
"@context": ["https://www.w3.org/2018/credentials/v1"],
"type": ["VerifiableCredential", "KYCCredential"],
"issuer": "did:pelago:issuer:pelago-kyc",
"issuanceDate": "2025-01-15T00:00:00Z",
"credentialSubject": {
"id": "did:pelago:stellar:GBXXX...XXX",
"kycLevel": "2",
"country": "US",
"verified": true
},
"proof": {
"type": "Ed25519Signature2020",
"created": "2025-01-15T00:00:00Z",
"verificationMethod": "did:pelago:issuer:pelago-kyc#key-1",
"proofValue": "z3FXQjecWufY..."
}
}
零知识证明
PID 使用零知识证明(ZKP)在不暴露底层数据的情况下证明属性。
示例:年龄验证
支持的证明类型
| 证明类型 | 可揭示 | 保持隐藏 |
|---|---|---|
| 年龄范围 | 高于/低于阈值 | 精确出生日期 |
| 位置 | 国家/地区 | 精确地址 |
| 余额 | 资金充足 | 精确金额 |
| 信用 | 评分范围 | 精确分数 |
创建 PID
通过 SDK
import { PelagoClient } from '@pelago/sdk';
const pelago = new PelagoClient({
apiKey: process.env.PELAGO_API_KEY!,
environment: 'production'
});
// 创建新 PID
const pid = await pelago.identity.createPID({
network: 'stellar',
walletAddress: 'GBXXX...',
metadata: {
displayName: 'My Store',
type: 'merchant'
}
});
console.log('PID:', pid.did);
// did:pelago:stellar:GBXXX...XXX
通过智能合约
// 直接合约交互
interface IPIDRegistry {
function createPID(
string calldata network,
bytes calldata publicKey,
bytes calldata metadata
) external returns (string memory did);
function resolveDID(
string calldata did
) external view returns (DIDDocument memory);
function addCredential(
string calldata did,
bytes calldata credential
) external returns (bool);
}
KYC 集成
PID 与 KYC 提供商集成以满足合规要求:
KYC 等级
| 等级 | 要求 | 限额 |
|---|---|---|
| 0 | 仅钱包 | $100/天 |
| 1 | 邮箱 + 手机 | $1,000/天 |
| 2 | 身份证件 | $10,000/天 |
| 3 | 完整企业 KYC | 无限制 |
KYA(了解你的代理)
用于 AI 代理支付(x402 协议):
// 注册 AI 代理
const agentPID = await pelago.identity.createAgentPID({
network: 'stellar',
agentId: 'agent-123',
operator: 'did:pelago:stellar:GBXXX...', // 人类运营者
capabilities: ['micropayments', 'subscriptions'],
spendingLimits: {
perTransaction: 100,
daily: 1000,
monthly: 10000
}
});
隐私最佳实践
- 数据最小化:仅请求必要的凭证
- 使用 ZKP:优先使用证明而非原始数据
- 凭证撤销:支持撤销检查
- 安全存储:切勿在服务端存储凭证