A zero-dependency Go library for Nostr.
You probably shouldn't use this.
This library rolls its own secp256k1 crypto in pure Go. No CGO, no external dependencies, no nothing. I built it to see if it was possible to implement Nostr with truly zero dependencies. It is. But that doesn't mean it's a good idea.
What you get: zero deps, auditable code, passes all BIP-340 test vectors, works fine for normal usage.
What you give up: constant-time operations, performance (~10x slower than btcec), battle-tested code.
If you're building something serious, use a library backed by btcec. If you're hacking on a side project or just want to read the code, welcome.
key, _ := nostr.GenerateKey()
fmt.Println("npub:", key.Npub())
event := &nostr.Event{
Kind: nostr.KindTextNote,
Content: "Hello Nostr!",
}
key.Sign(event)
relay, _ := nostr.Connect(ctx, "wss://relay.damus.io")
relay.Publish(ctx, event)