A cli util for generating nostr events
Go to file
2022-08-16 11:48:49 -07:00
deps embed libsecp256k1 build 2022-08-08 15:46:36 -07:00
devtools Add missing file 2022-08-09 07:51:04 -07:00
scripts scripts/nostr-query/relay-note: update relay to wss://relay.damus.io 2022-08-16 11:48:49 -07:00
.envrc direnv envrc 2022-07-13 10:40:33 -07:00
.gitignore direnv envrc 2022-07-13 10:40:33 -07:00
.gitmodules embed libsecp256k1 build 2022-08-08 15:46:36 -07:00
aes.c encrypted dms 2022-04-14 19:30:27 -07:00
aes.h encrypted dms 2022-04-14 19:30:27 -07:00
base64.c encrypted dms 2022-04-14 19:30:27 -07:00
base64.h encrypted dms 2022-04-14 19:30:27 -07:00
compiler.h initial commit 2022-04-14 07:52:29 -07:00
configurator.c initial commit 2022-04-14 07:52:29 -07:00
cursor.h initial commit 2022-04-14 07:52:29 -07:00
default.nix nix build 2022-04-20 17:15:25 -07:00
endian.h initial commit 2022-04-14 07:52:29 -07:00
hex.h initial commit 2022-04-14 07:52:29 -07:00
Makefile embed libsecp256k1 build 2022-08-08 15:46:36 -07:00
nostril.c make content optional, defaults to "" 2022-08-09 08:05:57 -07:00
proof.h add proof-of-work mining 2022-04-15 10:30:52 -07:00
random.h encrypted dms 2022-04-14 19:30:27 -07:00
README.md fix readme examples 2022-08-11 12:19:01 -07:00
sha256.c initial commit 2022-04-14 07:52:29 -07:00
sha256.h initial commit 2022-04-14 07:52:29 -07:00
shell.nix don't need openssl 2022-04-14 19:44:20 -07:00

nostril

A cli util for creating nostr events

Usage

usage: nostril [OPTIONS]

  OPTIONS

      --content                       the content of the note
      --dm <hex pubkey>               make an encrypted dm to said pubkey. sets kind and tags.
      --envelope                      wrap in ["EVENT",...] for easy relaying
      --kind <number>                 set kind
      --created-at <unix timestamp>   set a specific created-at time
      --sec <hex seckey>              set the secret key for signing, otherwise one will be randomly generated
      --pow <difficulty>              number of leading 0 bits of the id to mine
      --tag <key> <value>             add a tag
      -e <event_id>                   shorthand for --tag e <event_id>
      -p <pubkey>                     shorthand for --tag p <pubkey>

Examples

Generate an event:

$ ./nostril --sec <key> --content "this is a message"
{
  "id": "b5c18a4aa21231a77b09748a5e623d9c2f853aed09653934b80a10b66a7225fa",
  "pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
  "created_at": 1649948031,
  "kind": 1,
  "tags": [],
  "content": "testing something again",
  "sig": "5122b2fc0d9a1f1ca134e4ab6fc1c9e5795e2d558cf24e3c7d8c4a35f889130eebcbd604602092a89c8a48469e88753e08dabb472610ac628ec9db3aa6c24672"
}

Wrap event to send to a relay:

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

Send to a relay:

$ ./nostril --envelope --sec <key> --content "this is a message" | websocat wss://nostr-pub.wellorder.net

Send a nip04 DM:

$ ./nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://nostr-pub.wellorder.net