mirror of
https://github.com/jb55/nostril.git
synced 2024-12-24 11:15:51 -05:00
Release v0.1.0
This commit is contained in:
parent
ba7acb85a0
commit
a5e2478cfc
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -9,8 +9,16 @@ configurator
|
|||
.buildcmd
|
||||
config.h
|
||||
tags
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
libsecp256k1.a
|
||||
/target
|
||||
|
||||
Cargo.lock
|
||||
Cargo.toml
|
||||
doc/nostril.1
|
||||
*.json
|
||||
scripts/jb55-post
|
||||
scripts/nostr-follows
|
||||
scripts/nostr-req
|
||||
scripts/subnote
|
||||
/dist
|
||||
/version
|
||||
|
|
26
Makefile
26
Makefile
|
@ -7,7 +7,25 @@ ARS = libsecp256k1.a
|
|||
|
||||
SUBMODULES = deps/secp256k1
|
||||
|
||||
all: nostril
|
||||
all: nostril docs
|
||||
|
||||
docs: doc/nostril.1
|
||||
|
||||
doc/nostril.1: README.txt
|
||||
scdoc < $^ > $@
|
||||
|
||||
version: nostril.c
|
||||
grep '^#define VERSION' $< | sed -En 's,.*"([^"]+)".*,\1,p' > $@
|
||||
|
||||
dist: docs version
|
||||
@mkdir -p dist
|
||||
git archive HEAD --format tar.gz --prefix nostril-$(shell cat version)/ -o dist/nostril-$(shell cat version).tar.gz
|
||||
@ls -dt dist/* | head -n1 | xargs echo "tgz "
|
||||
cd dist;\
|
||||
sha256sum *.tar.gz > SHA256SUMS.txt;\
|
||||
gpg -u 0x8A478B64FFE30F1095A8736BF5F27EFD1B38DABB --sign --armor --detach-sig --output SHA256SUMS.txt.asc SHA256SUMS.txt
|
||||
rsync -avzP dist/ charon:/www/cdn.jb55.com/tarballs/nostril/
|
||||
scp CHANGELOG charon:/www/cdn.jb55.com/tarballs/nostril/CHANGELOG.txt
|
||||
|
||||
deps/secp256k1/.git:
|
||||
@devtools/refresh-submodules.sh $(SUBMODULES)
|
||||
|
@ -36,9 +54,9 @@ libsecp256k1.a: deps/secp256k1/.libs/libsecp256k1.a
|
|||
nostril: $(HEADERS) $(OBJS) $(ARS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(ARS) -o $@
|
||||
|
||||
install: nostril
|
||||
mkdir -p $(PREFIX)/bin
|
||||
cp nostril $(PREFIX)/bin
|
||||
install: all
|
||||
install -Dm644 doc/nostril.1 $(PREFIX)/share/man/man1/nostril.1
|
||||
install -Dm755 nostril $(PREFIX)/bin/nostril
|
||||
|
||||
config.h: configurator
|
||||
./configurator > $@
|
||||
|
|
81
README.md
81
README.md
|
@ -1,81 +0,0 @@
|
|||
|
||||
# nostril
|
||||
|
||||
A cli util for creating nostr events
|
||||
|
||||
## Installation
|
||||
|
||||
### Fedora
|
||||
|
||||
```bash
|
||||
$ sudo dnf install libtool automake
|
||||
$ make
|
||||
|
||||
# Optional - install to system PATH
|
||||
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
## 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": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
|
||||
"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
|
||||
"created_at": 1660750302,
|
||||
"kind": 1,
|
||||
"tags": [],
|
||||
"content": "this is a message",
|
||||
"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
|
||||
}
|
||||
|
||||
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://relay.damus.io
|
||||
|
||||
Send a nip04 DM:
|
||||
|
||||
$ ./nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
|
||||
|
||||
Mine a pubkey:
|
||||
|
||||
$ ./nostril --mine-pubkey --pow <difficulty>
|
||||
|
||||
Reply to an event. nip10 compliant, includes the `thread_id`:
|
||||
|
||||
$ ./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
|
107
README.txt
Normal file
107
README.txt
Normal file
|
@ -0,0 +1,107 @@
|
|||
nostril(1)
|
||||
|
||||
# NAME
|
||||
|
||||
nostril - generate nostr events
|
||||
|
||||
# SYNPOSIS
|
||||
|
||||
*nostril* [OPTIONS...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
*nostril* is a tool that creates and signs nostr events.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*--content*
|
||||
The text contents of the note
|
||||
|
||||
*--dm* <hex pubkey>
|
||||
Create a direct message. This will create a kind-4 note with the
|
||||
contents encrypted>
|
||||
|
||||
*--envelope*
|
||||
Wrap the event with `["EVENT", ... ]` for easy relaying
|
||||
|
||||
*--kind* <number>
|
||||
Set the kind of the note
|
||||
|
||||
*--created-at* <unix timestamp>
|
||||
Set the created at. Optional, this is set automatically.
|
||||
|
||||
*--mine-pubkey*
|
||||
Mine a pubkey. This may or may not be cryptographically dubious.
|
||||
|
||||
*--pow* <difficulty>
|
||||
Number of leading 0 bits of the id the mine for proof-of-work.
|
||||
|
||||
*--tag* <key> <value>
|
||||
Add a tag with a single value
|
||||
|
||||
*-t*
|
||||
Shorthand for --tag t <hashtag>
|
||||
|
||||
*-p*
|
||||
Shorthand for --tag p <hex pubkey>
|
||||
|
||||
*-e*
|
||||
Shorthand for --tag e <note id>
|
||||
|
||||
|
||||
# Examples
|
||||
|
||||
*Generate an event*
|
||||
|
||||
```
|
||||
$ ./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"
|
||||
}
|
||||
```
|
||||
|
||||
*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://relay.damus.io
|
||||
```
|
||||
|
||||
*Send a nip04 DM*
|
||||
|
||||
```
|
||||
nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
|
||||
```
|
||||
|
||||
*Mine a pubkey*
|
||||
|
||||
```
|
||||
nostril --mine-pubkey --pow <difficulty>
|
||||
```
|
||||
|
||||
*Reply to an event. nip10 compliant, includes the `thread_id`*
|
||||
|
||||
```
|
||||
./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
|
||||
```
|
9
doc/INSTALL.txt
Normal file
9
doc/INSTALL.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
Fedora
|
||||
------
|
||||
|
||||
$ sudo dnf install libtool automake
|
||||
$ make
|
||||
|
||||
# Optional - install to system PATH
|
||||
|
||||
$ sudo make install
|
|
@ -18,6 +18,8 @@
|
|||
#include "random.h"
|
||||
#include "proof.h"
|
||||
|
||||
#define VERSION "0.1.0"
|
||||
|
||||
#define MAX_TAGS 32
|
||||
#define MAX_TAG_ELEMS 16
|
||||
|
||||
|
@ -425,6 +427,11 @@ static int parse_args(int argc, const char *argv[], struct args *args, struct no
|
|||
argv++; argc--;
|
||||
for (; argc; ) {
|
||||
arg = *argv++; argc--;
|
||||
|
||||
if (!strcmp(arg, "--help")) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!argc) {
|
||||
fprintf(stderr, "expected argument: '%s'\n", arg);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user