Skip to content

Commit

Permalink
added new feature: --nsec
Browse files Browse the repository at this point in the history
Now one can run a command like this to fire-and-forget, i.e. send a message
without a config file and forget everything after message has been sent:

nostr-commander-rs --nsec nsec1SomeStrangeString --add-relay "wss://some.relay.net/" --publish "some text"

or

nostr-commander-rs --nsec $NSEC --add-relay "wss://some.relay.net/" --publish - < SOMETEXTFILE.txt
  • Loading branch information
8go committed Sep 30, 2024
1 parent 4185933 commit 94f3c00
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 123 deletions.
125 changes: 46 additions & 79 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "nostr-commander"
version = "0.2.5"
version = "0.3.0"
edition = "2021"
description = "simple but convenient CLI-based Nostr client app for publishing,sending and subscribing"
documentation = "https://docs.rs/nostr-commander"
Expand Down Expand Up @@ -39,7 +39,7 @@ chrono = "0.4"
json = "0.12"
atty = "0.2"
reqwest = "0.11"
regex = "1.9"
regex = "1.11"


[dev-dependencies]
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ $ nostr-commander-rs --subscribe-channel 25e5c82273a271cb1a840d0060391a0bf4965ca
```
Welcome to "nostr-commander-rs", a Nostr CLI client. ─── On the first run use
--create-user to create a user. On further runs you can publish notes, send
private DM messages, etc. ─── Have a look at the repo
"https://github.com/8go/nostr-commander-rs/" and see if you can contribute code
to improve this tool. Safe!
private DM messages, etc. Alternatively, you can skip creating a user and do a
fire-and-forget publish like this: nostr-commander-rs --nsec
nsec1SomeStrangeString --add-relay "wss://some.relay.net/" --publish "test".
─── Have a look at the repo "https://github.com/8go/nostr-commander-rs/" and
see if you can contribute code to improve this tool. Safe!
Usage: nostr-commander-rs [OPTIONS]
Expand Down Expand Up @@ -236,9 +238,10 @@ Options:
Create a new user, i.e. a new key pair. Details:: This is usually
done only once at the beginning. If you ever want to wipe this user,
use '--delete-user' which deletes the key pair. Use this option in
combination with --name, --display_name, --about, --picture, and
--nip05. Also highly recommended that you use this option together
with --add-relay
combination with --name, --display_name, --about, --picture, --nip05,
and --nsec. Also highly recommended that you use this option together
with --add-relay. Add --nsec as option to import your existing nsec
private key, otherwise a new private key will be generated for you
--delete-user
Delete the current user, i.e. delete the current key pair. Details::
Expand Down Expand Up @@ -278,6 +281,18 @@ Options:
be queried via the keyboard. If you want to set it to empty and not
be queried, provide an empty string ''
--nsec <PRIVATE_KEY>
Provide one private key. Details:: It has the form
'nsec1SomeStrangeString'. Alternatively you can use the Hex form of
the private key. Since this is your private key, you must protect it.
Don't put this key into a script, into Github, etc. If --nsec is
provided it will be used instead of the private key in the
credentials file. This argument is used e.g. in combination with
argument --publish. If you are using --nsec without a credentials
file most likely you want to also use -ad-relay argument. If --nsec
is used without --create-user then the credentials file will not be
modified or will not be created
-p, --publish [<NOTE>...]
Publish one or multiple notes. Details:: Notes data must not be
binary data, it must be text. Input piped via stdin can additionally
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.5
0.3.0
10 changes: 7 additions & 3 deletions help.help.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Welcome to "nostr-commander-rs", a Nostr CLI client. ─── On the first run use
--create-user to create a user. On further runs you can publish notes, send
private DM messages, etc. ─── Have a look at the repo
"https://github.com/8go/nostr-commander-rs/" and see if you can contribute code
to improve this tool. Safe!
private DM messages, etc. Alternatively, you can skip creating a user and do a
fire-and-forget publish like this: nostr-commander-rs --nsec
nsec1SomeStrangeString --add-relay "wss://some.relay.net/" --publish "test".
─── Have a look at the repo "https://github.com/8go/nostr-commander-rs/" and
see if you can contribute code to improve this tool. Safe!
Usage: nostr-commander-rs [OPTIONS]
Options:
--contribute
Expand Down Expand Up @@ -39,6 +41,8 @@ Options:
Specify an optional picture or avatar.
--nip05 <NIP05_ID>
Specify an optional nip05 name.
--nsec <PRIVATE_KEY>
Provide one private key.
-p, --publish [<NOTE>...]
Publish one or multiple notes.
--publish-pow [<NOTE>...]
Expand Down
Loading

0 comments on commit 94f3c00

Please sign in to comment.