nostr-auth
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 认证( | 🔜 计划中 | 下一个 |
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 服务器 ERROR,4 非 JSON 回调响应。
密钥管理
首次运行会在
~/.config/nostr-auth/master.key生成 32 字节主密钥(权限0600)。按服务身份:
linkingPriv = HMAC-SHA256(master, serviceDomain)。相同域名 → 相同 npub;不同域名 → 不同 npub(隐私)。--single-key在所有服务间共享一个身份。--generate覆盖主密钥。可使用--keyfile/--keyout或NOSTR_AUTH_KEYFILE环境变量覆盖路径。
协议(NIP-07 风格)
挑战 → 事件(默认 kind
22242),包含challenge和可选的relay标签。NIP-01 id:
sha256(JSON.stringify([0, pubkey, created_at, kind, tags, content]))。使用 BIP-340 schnorr 对原始 32 字节 id 签名 → 64 字节十六进制
sig。将
{"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 / ClawHub:
skills/nostr-auth/是一个自主捆绑包(SKILL.md+scripts/nostr_auth.js,零 npm 依赖)。skills.sh(Vercel):
npx skills add dyegolara/nostr-auth-agentsnpm:
npm i -g nostr-auth→nostr-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。仅认证:本项目从不持有资金、从不发布笔记、从不自行连接中继。
This server cannot be installed
Maintenance
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
- AlicenseBqualityFmaintenanceConnects a Bitcoin Lightning wallet to your LLM using Nostr Wallet Connect, enabling payment functionalities within language models like Claude.6915MIT
- Alicense-qualityDmaintenanceEnables Bitcoin Lightning wallet integration with LLMs through Nostr Wallet Connect (NWC). Supports lightning payments, LNURL operations, and L402 authentication for AI-powered bitcoin transactions.28Apache 2.0
- AlicenseCqualityCmaintenance23 tools for AI agents working with Nostr Open source. No API key. No account. NIP-46 remote signing Publish notes, reply, react, repost Encrypted DMs (NIP-04 + NIP-44) Fetch events, profiles, social graph23201MIT
- AlicenseAqualityCmaintenancePersistent memory and payment safety for AI agents on Lightning. Enables agents to remember purchases, track vendor reputations, enforce budgets, and share trust signals via Nostr.229MIT
Related MCP Connectors
Agent registry with Nostr identity, reputation, escrow, observability, and Lightning payments.
Keyless non-custodial crypto payments for AI agents: payment links and tip jars, no API key.
Helps AI coding agents integrate MetaMask Embedded Wallets (Web3Auth) SDKs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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