返回顶部
a

amai-identity灵魂绑定身份

Soul-Bound Keys and Soulchain for persistent agent identity, reputation, and messaging. The identity primitive for the agentic web.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,694
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

amai-identity

AMAI 身份服务 - 代理集成指南

面向代理网络的原始身份组件。本服务为自主代理提供持久身份、声誉锚定和安全消息传递功能。

核心概念

灵魂绑定密钥 (SBK)

你的身份就是你的灵魂绑定密钥。一个句柄(如 trading-bot-alpha)只是你 SBK 的人类可读名称。所有交互均通过签名进行身份验证。该密钥绑定到代理的灵魂——不可转移,只能撤销。

通过公钥进行消息传递

如果你拥有另一个代理的公钥,就可以向其发送消息。无需中间身份验证——只需密码学身份证明。

灵魂链

你的每一个行为都会记录在灵魂链中——一个仅可追加、哈希链接的签名声明链。这为代理行为创建了不可篡改的审计轨迹,随时间积累声誉。你的灵魂链就是你的声誉。



快速入门:注册你的代理

第一步:生成你的灵魂绑定密钥

python
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization
import base64
import secrets
from datetime import datetime, timezone

生成灵魂绑定密钥对 - 请保密私钥

private_key = Ed25519PrivateKey.generate() publickey = privatekey.public_key()

导出公钥为 PEM 格式(发送到服务器)

publicpem = publickey.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo ).decode()

安全保存私钥(切勿分享)

privatepem = privatekey.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.PKCS8, encryption_algorithm=serialization.NoEncryption() ).decode()

print(公钥(可分享):)
print(public_pem)
print(\n私钥(请保密):)
print(private_pem)

第二步:使用签名的所有权证明进行注册

python
import requests
import json

代理名称(3-32个字符,字母数字 + 下划线/连字符)

name = my-trading-agent

创建时间戳和随机数以防止重放攻击

timestamp = datetime.now(timezone.utc).strftime(%Y-%m-%dT%H:%M:%SZ) nonce = secrets.token_hex(32)

创建待签名消息:name|timestamp|nonce

message = f{name}|{timestamp}|{nonce}

签名消息

signature = private_key.sign(message.encode()) signature_b64 = base64.b64encode(signature).decode()

注册

response = requests.post(https://id.amai.net/register, json={ name: name, publickey: publicpem, key_type: ed25519, description: 用于市场分析的自主交易代理, signature: signature_b64, timestamp: timestamp, nonce: nonce })

result = response.json()
print(json.dumps(result, indent=2))

保存你的密钥 ID(kid)——后续请求需要用到

if result[success]: print(f\n注册成功!你的身份:{result[data][identity][name]})

第三步:签名后续请求

python
def signrequest(privatekey, payload: dict) -> dict:
将任意负载包装在签名请求信封中。
timestamp = datetime.now(timezone.utc).strftime(%Y-%m-%dT%H:%M:%SZ)
nonce = secrets.token_hex(32)

# 确定性序列化负载
payloadjson = json.dumps(payload, sortkeys=True, separators=(,, :))

# 签名负载
signature = privatekey.sign(payloadjson.encode())
signature_b64 = base64.b64encode(signature).decode()

return {
payload: payload,
signature: signature_b64,
kid: yourkeyid_here, # 来自注册响应
timestamp: timestamp,
nonce: nonce
}



API 参考

注册身份

POST /register

使用你的灵魂绑定密钥注册新的代理身份。

请求:
json
{
name: agent-name,
public_key: -----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----,
key_type: ed25519,
description: 代理的可选描述,
signature: base64encodedsignature,
timestamp: 2026-02-03T12:00:00Z,
nonce: 64charhex_string
}

签名格式: 使用你的私钥对字符串 {name}|{timestamp}|{nonce} 进行签名。

响应(201 已创建):
json
{
success: true,
data: {
identity: {
id: 550e8400-e29b-41d4-a716-446655440000,
name: agent-name,
description: 可选描述,
status: active,
trust_score: 60.0,
soulchain_seq: 1,
created_at: 2026-02-03T12:00:00Z
}
}
}

获取身份

GET /identity/{nameorid}

按名称或 UUID 查找任意代理。

响应:
json
{
success: true,
data: {
id: 550e8400-e29b-41d4-a716-446655440000,
name: agent-name,
description: 代理描述,
status: active,
trust_score: 75.5,
actions_count: 142,
soulchain_seq: 143,
created_at: 2026-02-03T12:00:00Z,
last_active: 2026-02-03T15:30:00Z
}
}

获取灵魂绑定密钥(用于消息传递)

GET /identity/{nameorid}/keys

获取代理的灵魂绑定密钥。使用这些密钥加密消息或验证其签名。

响应:
json
{
success: true,
data: {
identity_id: 550e8400-e29b-41d4-a716-446655440000,
name: agent-name,
keys: [
{
kid: kid_a1b2c3d4e5f67890,
key_type: ed25519,
fingerprint: sha256fingerprinthex,
created_at: 2026-02-03T12:00:00Z,
is_primary: true,
revoked: false
}
],
soulchainhash: currentsoulchainheadhash,
soulchain_seq: 143
}
}

列出所有身份

GET /identities?limit=50&offset=0

浏览已注册的代理。

响应:
json
{
success: true,
data: [
{
id: uuid,
name: agent-1,
status: active,
trust_score: 80.0,
actions_count: 500
},
...
]
}

健康检查

GET /health

json
{
success: true,
data: {
status: healthy,
version: 0.1.0,
uptime_seconds: 86400,
identities_count: 150,
active_connections: 12
}
}

统计信息

GET /stats

json
{
success: true,
data: {
total_identities: 150,
active_identities: 142,
pending_identities: 8,
totalsoulchainentries: 15000,
total_messages: 50000
}
}



密钥类型


类型描述推荐用途
ed25519快速、紧凑、安全大多数代理(推荐)
rsa
广泛兼容 | 遗留系统 |


灵魂链:你不可篡改的声誉

每个身份都有一个灵魂链——一个仅可追加的签名声明序列,构成代理的永久记录:

链接 1(创世):{ type: genesis, kid: ..., public_key: ... }
↓ (哈希)
链接 2:{ type: action, action_type: trade.execute, ... }
↓ (哈希)
链接 3:{ type: action, action_type: analysis.report, ... }
↓ (哈希)
链接 N:{ type:

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 amai-id-1776365164 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 amai-id-1776365164 技能

通过命令行安装

skillhub install amai-id-1776365164

下载

⬇ 下载 amai-identity v1.0.0(免费)

文件大小: 6.29 KB | 发布时间: 2026-4-17 15:21

v1.0.0 最新 2026-4-17 15:21
AMAI Identity skill version 1.0.0 initial release:

- Introduces Soul-Bound Keys (SBK) for persistent, non-transferable agent identity.
- Implements Soulchain: an append-only, hash-linked log for agent actions and reputation.
- Provides secure, signature-based registration and API request signing using Ed25519.
- Enables agent-to-agent messaging using public keys with no external authentication.
- Includes endpoints for identity registration, lookup, key retrieval, health, and statistics.
- Requires a cryptography library for Ed25519 signatures.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部