Skip to main content
Glama

nostr-auth-agents

面向 LLM 编码代理的 Nostr 登录 — 仅认证,无钱包、无浏览器扩展、无中继账户。

代理(Claude Code、OpenCode、OpenClaw、Codex、Cursor 等)会收到一个"使用 Nostr 登录"挑战或事件模板。本仓库使用从本地主密钥派生的 secp256k1(BIP-340 schnorr)密钥对其签名,并可选择将签名提交给服务回调。

零 npm 运行时依赖:纯 BigInt secp256k1/schnorr + node:crypto。从干净克隆即可启动。

方法

方法

状态

备注

NIP-07 登录(挑战事件签名)

✅ v1.0.0

镜像 LNURL-auth 的用户体验

NIP-98 HTTP 认证(Authorization: Nostr <event>

🔜 计划中

下一个

NIP-42 中继 AUTH(websocket)

🔜 计划中

NIP-05 标识符解析

🔜 计划中

Related MCP server: Alby Bitcoin Payments MCP Server

用法

# Sign a classic kind-22242 sign-in challenge and submit it
node nostr_auth.js nip07 --challenge "<hex>" \
  --relay "wss://relay.example.com" \
  --domain example.com \
  --callback "https://site.example.com/verify"

# Dry-run: sign but don't submit (inspect first)
node nostr_auth.js nip07 --challenge "<hex>" --dry-run --json

# Sign an arbitrary event template (what window.nostr.signEvent would do)
node nostr_auth.js nip07 '{"kind":22242,"tags":[["challenge","<hex>"]],"content":""}'

# Print the derived identity (hex pubkey + npub)
node nostr_auth.js nip07 pubkey --domain example.com

进度日志输出到 stderr;结果(JSON)输出到 stdout。退出码:0 已接受,1 客户端错误,2 用法错误,3 服务器 ERROR4 非 JSON 回调响应。

密钥管理

  • 首次运行会在 ~/.config/nostr-auth/master.key 生成 32 字节主密钥(权限 0600)。

  • 按服务身份:linkingPriv = HMAC-SHA256(master, serviceDomain)。相同域名 → 相同 npub;不同域名 → 不同 npub(隐私)。

  • --single-key 在所有服务间共享一个身份。

  • --generate 覆盖主密钥。可使用 --keyfile/--keyoutNOSTR_AUTH_KEYFILE 环境变量覆盖路径。

协议(NIP-07 风格)

  1. 挑战 → 事件(默认 kind 22242),包含 challenge 和可选的 relay 标签。

  2. NIP-01 id:sha256(JSON.stringify([0, pubkey, created_at, kind, tags, content]))

  3. 使用 BIP-340 schnorr 对原始 32 字节 id 签名 → 64 字节十六进制 sig

  4. {"event": {...}} POST 到回调 → {"status":"OK"} / {"status":"ERROR","reason":"..."}

完整面向代理的文档请参阅 SKILL.md

MCP 服务器

零依赖 stdio MCP 服务器(mcp/server.js),提供 nostr_nip07_sign / nostr_nip07_pubkey 工具:

{
  "mcpServers": {
    "nostr-auth": { "command": "node", "args": ["mcp/server.js"] }
  }
}

包含适用于 Claude Code(.claude-plugin/)、Codex、Cursor 的插件清单,以及 skills.sh 可发现性(skills.sh.json)。各平台的分发状态请参阅 PUBLISHING.md

安装为代理技能(按平台)

  • Claude Code / 任意 MCP 客户端:将仓库放入你的 skills 目录,使用 SKILL.md + .mcp.json

  • OpenClaw / ClawHubskills/nostr-auth/ 是一个自主捆绑包(SKILL.md + scripts/nostr_auth.js,零 npm 依赖)。

  • skills.sh(Vercel)npx skills add dyegolara/nostr-auth-agents

  • npmnpm i -g nostr-authnostr-auth nip07 ...

自测(离线、零成本)

npm ci
npm test

本地模拟"使用 Nostr 登录"服务(mock_server.js)验证挑战 → 签名 → 提交 → 验证的完整往返、重放拒绝、试运行安全性、按域身份稳定性,以及可移植的技能捆绑包。

项目结构

nostr_auth.js        CLI (bin "nostr-auth")
lib/                 key mgmt, BIP-340 schnorr, NIP-01 events, NIP-07 flow
mcp/server.js        zero-dep MCP server (stdio)
mock_server.js       local sign-in mock for tests
skills/nostr-auth/   portable OpenClaw/ClawHub skill bundle
contrib/anthropics/  educational skill variant for anthropics/skills
test/                vitest suite

许可证

MIT — 参见 LICENSE。仅认证:本项目从不持有资金、从不发布笔记、从不自行连接中继。

A
license - permissive license
-
quality - not tested
-
maintenance - not tested

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dyegolara/nostr-auth-agents'

If you have feedback or need assistance with the MCP directory API, please join our Discord server