zig-nostr/nostr
GitHub: zig-nostr/nostr
为 Zig 语言提供 Nostr 去中心化协议的核心实现,涵盖密钥、签名、事件模型与编码等基础能力。
Stars: 4 | Forks: 0
# nostr
用于 [Zig](https://ziglang.org) 的 [Nostr](https://nostr.com) 协议库。
[](https://github.com/zig-nostr/nostr/actions/workflows/ci.yml)
[](LICENSE)
`zig-nostr/nostr` 致力于成为 Zig 的基础 Nostr 实现,
秉承 Rust 的 [`rust-nostr`](https://github.com/rust-nostr/nostr) 之精神:密钥与编码,事件构造与 BIP-340 签名,基于
outbox 模型的 relay 传输,NIP-44/NIP-17 加密消息,以及仿照
[nostrdb](https://github.com/damus-io/nostrdb) 构建的零拷贝本地事件存储。
**状态:pre-alpha,`v0.1.0`。** 里程碑 A2(库核心)已发布:
secp256k1 密钥与 BIP-340 Schnorr 签名(经过审计的 libsecp256k1
绑定,完整的官方测试向量套件通过),带有规范 id 哈希和签名的 NIP-01 事件模型,
NIP-19 bech32 实体编码,
NIP-06 基于 mnemonic 的密钥派生,以及 NIP-49 加密密钥存储。
Relay 传输、outbox 模型和本地事件存储将在
即将到来的里程碑中推出 — 请参阅 [`CURRENT_STATE.md`](CURRENT_STATE.md) 了解正在进行的工作,以及
[project board](https://github.com/orgs/zig-nostr/projects) 获取完整的
里程碑路线图。
## 安装
```
zig fetch --save https://github.com/zig-nostr/nostr/archive/refs/tags/v0.1.0.tar.gz
```
然后在 `build.zig` 中:
```
const nostr = b.dependency("nostr", .{ .target = target, .optimize = optimize });
your_module.addImport("nostr", nostr.module("nostr"));
```
## 开发
```
zig build # build the library
zig build test # run the test suite
zig fmt --check . # verify formatting
```
Zig 版本锁定在 [`.zigversion`](.zigversion) 中。
## 贡献
请参阅 [`CONTRIBUTING.md`](CONTRIBUTING.md) 了解分支/PR/commit 工作流程,
以及 [`AGENTS.md`](AGENTS.md) 获取面向贡献者和 agent 的代码库概述。
## License
MIT — 详见 [`LICENSE`](LICENSE)。
标签:Nostr, Zig, 内核驱动, 去中心化, 密码学, 开发库, 手动系统调用, 网络协议