

Welcome to the official r/nostr subreddit, home to all things Nostr. Nostr is an innovation in how digital text can be sent and received. Anyone can join and anyone can build apps freely using the protocol. There's almost certainly something here for you. Let's dive in!
How do I generate the keys locally?
I keep clicking around, but can't find how to properly start.
What I'd like is a CLI utility (preferably in Rust, or available in NixOS) that I could use to generate the key locally. Then I can put the public key in https://branle.netlify.app and sign my posts from CLI, I guess.
Could I maybe use my pgp on a yubikey?
Please excuse if this is not the best place to ask, and thank you.
Sort by:
Best
Open comment sort options
Best
Top
New
Controversial
Old
Q&A
Nostril is a command line utility that allows you to generate pubkey/private key, as well as even sign events.
To generate your own #nostr private key on linux or command line, run:
$ openssl rand -hex 32
this creates a 256 bit random number, and prints it in hex format, which is taken by nostr clients. You can take this as private key, and then enter into a client, which would show you the public key.
and how to convert to nsec format from that please ?
How safe is this method of key generation? what is the likelihood that somebody else hasn't allready made a table of pre-generated key pairs?
lol is it that simple?
You could use python-nostr https://github.com/jeffthibault/python-nostr
and generate a keypair in a little python script
from nostr.key import PrivateKey
private_key = PrivateKey()
public_key = private_key.public_key
print(private_key)
print(public_key)
Thanks!