From 9d20d2281f4698024b7be67d1b86178b4e8e2484 Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 12:12:37 -0800 Subject: Clean up project structure - Add README.md - Move benchmark files to benchmarks/ - Move PLAN.md to .claude/ - Add .gitignore --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e7c891 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# nostr + +A Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr). + +```bash +go get code.northwest.io/nostr +``` + +## Features + +- **Keys** — Generate, parse, and convert between hex/bech32 (npub/nsec) +- **Events** — Create, sign, and verify NIP-01 events +- **Filters** — Build subscription filters +- **Relay** — WebSocket connections with publish/subscribe +- **Tags** — Parse and build event tags + +## Usage + +```go +package main + +import ( + "context" + "fmt" + "code.northwest.io/nostr" +) + +func main() { + // Generate a new key pair + key, _ := nostr.GenerateKey() + fmt.Println("npub:", key.Npub()) + + // Create and sign an event + event := &nostr.Event{ + Kind: nostr.KindTextNote, + Content: "Hello Nostr!", + } + event.Sign(key) + + // Connect to a relay and publish + ctx := context.Background() + relay, _ := nostr.Connect(ctx, "wss://relay.damus.io") + defer relay.Close() + + relay.Publish(ctx, event) +} +``` + +## Examples + +See [examples/basic](examples/basic) for a complete runnable example. + +## Benchmarks + +Performance benchmarks are in [benchmarks/](benchmarks/). + +## License + +MIT -- cgit v1.2.3