Skip to content

Commit 94f3c00

Browse files
committed
added new feature: --nsec
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
1 parent 4185933 commit 94f3c00

File tree

8 files changed

+186
-123
lines changed

8 files changed

+186
-123
lines changed

Cargo.lock

Lines changed: 46 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "nostr-commander"
5-
version = "0.2.5"
5+
version = "0.3.0"
66
edition = "2021"
77
description = "simple but convenient CLI-based Nostr client app for publishing,sending and subscribing"
88
documentation = "https://docs.rs/nostr-commander"
@@ -39,7 +39,7 @@ chrono = "0.4"
3939
json = "0.12"
4040
atty = "0.2"
4141
reqwest = "0.11"
42-
regex = "1.9"
42+
regex = "1.11"
4343

4444

4545
[dev-dependencies]

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ $ nostr-commander-rs --subscribe-channel 25e5c82273a271cb1a840d0060391a0bf4965ca
148148
```
149149
Welcome to "nostr-commander-rs", a Nostr CLI client. ─── On the first run use
150150
--create-user to create a user. On further runs you can publish notes, send
151-
private DM messages, etc. ─── Have a look at the repo
152-
"https://github.com/8go/nostr-commander-rs/" and see if you can contribute code
153-
to improve this tool. Safe!
151+
private DM messages, etc. Alternatively, you can skip creating a user and do a
152+
fire-and-forget publish like this: nostr-commander-rs --nsec
153+
nsec1SomeStrangeString --add-relay "wss://some.relay.net/" --publish "test".
154+
─── Have a look at the repo "https://github.com/8go/nostr-commander-rs/" and
155+
see if you can contribute code to improve this tool. Safe!
154156
155157
Usage: nostr-commander-rs [OPTIONS]
156158
@@ -236,9 +238,10 @@ Options:
236238
Create a new user, i.e. a new key pair. Details:: This is usually
237239
done only once at the beginning. If you ever want to wipe this user,
238240
use '--delete-user' which deletes the key pair. Use this option in
239-
combination with --name, --display_name, --about, --picture, and
240-
--nip05. Also highly recommended that you use this option together
241-
with --add-relay
241+
combination with --name, --display_name, --about, --picture, --nip05,
242+
and --nsec. Also highly recommended that you use this option together
243+
with --add-relay. Add --nsec as option to import your existing nsec
244+
private key, otherwise a new private key will be generated for you
242245
243246
--delete-user
244247
Delete the current user, i.e. delete the current key pair. Details::
@@ -278,6 +281,18 @@ Options:
278281
be queried via the keyboard. If you want to set it to empty and not
279282
be queried, provide an empty string ''
280283
284+
--nsec <PRIVATE_KEY>
285+
Provide one private key. Details:: It has the form
286+
'nsec1SomeStrangeString'. Alternatively you can use the Hex form of
287+
the private key. Since this is your private key, you must protect it.
288+
Don't put this key into a script, into Github, etc. If --nsec is
289+
provided it will be used instead of the private key in the
290+
credentials file. This argument is used e.g. in combination with
291+
argument --publish. If you are using --nsec without a credentials
292+
file most likely you want to also use -ad-relay argument. If --nsec
293+
is used without --create-user then the credentials file will not be
294+
modified or will not be created
295+
281296
-p, --publish [<NOTE>...]
282297
Publish one or multiple notes. Details:: Notes data must not be
283298
binary data, it must be text. Input piped via stdin can additionally

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.5
1+
0.3.0

help.help.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Welcome to "nostr-commander-rs", a Nostr CLI client. ─── On the first run use
22
--create-user to create a user. On further runs you can publish notes, send
3-
private DM messages, etc. ─── Have a look at the repo
4-
"https://github.com/8go/nostr-commander-rs/" and see if you can contribute code
5-
to improve this tool. Safe!
3+
private DM messages, etc. Alternatively, you can skip creating a user and do a
4+
fire-and-forget publish like this: nostr-commander-rs --nsec
5+
nsec1SomeStrangeString --add-relay "wss://some.relay.net/" --publish "test".
6+
─── Have a look at the repo "https://github.com/8go/nostr-commander-rs/" and
7+
see if you can contribute code to improve this tool. Safe!
68
Usage: nostr-commander-rs [OPTIONS]
79
Options:
810
--contribute
@@ -39,6 +41,8 @@ Options:
3941
Specify an optional picture or avatar.
4042
--nip05 <NIP05_ID>
4143
Specify an optional nip05 name.
44+
--nsec <PRIVATE_KEY>
45+
Provide one private key.
4246
-p, --publish [<NOTE>...]
4347
Publish one or multiple notes.
4448
--publish-pow [<NOTE>...]

0 commit comments

Comments
 (0)