5 个版本

0.0.48 2024年6月7日
0.0.47 2024年6月7日
0.0.46 2024年6月7日
0.0.45 2024年6月7日
0.0.44 2024年5月21日

#1006开发工具

Download history 182/week @ 2024-05-17 17/week @ 2024-05-24 433/week @ 2024-06-07 11/week @ 2024-06-14 3/week @ 2024-06-28 16/week @ 2024-07-05 53/week @ 2024-07-26 6/week @ 2024-08-02

每月 59 次下载

Apache-2.0

105KB
2.5K SLoC

C 2K SLoC // 0.2% comments Rust 99 SLoC // 0.2% comments Shell 83 SLoC // 0.1% comments

nostril(1)

名称

nostril - 生成 nostr 事件

概要

nostril [选项...]

描述

nostril 是一个创建和签名 nostr 事件的工具。

选项

--content 笔记的文本内容

--dm 创建一条直接消息。这将创建一个类型为 4 的加密笔记

--envelope 使用 ["EVENT", ... ] 包装事件,以便轻松中继

--kind 设置笔记的类型

--created-at 设置创建时间。可选,此值自动设置。

--mine-pubkey 挖掘公钥。这可能或可能不是密码学上有疑问的。

--pow 为证明工作挖掘的 id 的前导 0 比特数

--tag 添加一个带单个值的标签

-t --tag t 的简称

-p --tag p 的简称

-e --tag e 的简称

示例

生成事件

$ ./nostril --sec <key> --content "this is a message"
{
	"id": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
	"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
	"created_at": 1660750302,
	"kind": 1,
	"tags": [],
	"content": "this is a message",
	"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
}

将事件包装以发送到中继

$ ./nostril --envelope --sec <key> --content "hello"
[ "EVENT",
{
	"id": "ed378d3fdda785c091e9311c6e6eeb075db349a163c5e38de95946f6013a8001",
	"pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
	"created_at": 1649948103,
	"kind": 1,
	"tags": [],
	"content": "hello",
	"sig": "9d9a49bbc66d4782030b24c71416965e790214d02a54ab132d960c2b02def0371c3d93e5a60a285c55e99721599d1332450731e2c6bb1114b96b591c6967f872"
} ]

发送到中继

nostril --envelope --sec <key> --content "this is a message" | websocat wss://relay.damus.io

发送一个 nip04 DM

nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io

挖掘公钥

nostril --mine-pubkey --pow <difficulty>

回复事件。nip10 兼容,包括 thread_id

./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io

依赖项

~1.8–2.6MB
~57K SLoC