summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0e7c891
--- /dev/null
+++ b/README.md
@@ -0,0 +1,59 @@
1# nostr
2
3A Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr).
4
5```bash
6go get code.northwest.io/nostr
7```
8
9## Features
10
11- **Keys** — Generate, parse, and convert between hex/bech32 (npub/nsec)
12- **Events** — Create, sign, and verify NIP-01 events
13- **Filters** — Build subscription filters
14- **Relay** — WebSocket connections with publish/subscribe
15- **Tags** — Parse and build event tags
16
17## Usage
18
19```go
20package main
21
22import (
23 "context"
24 "fmt"
25 "code.northwest.io/nostr"
26)
27
28func main() {
29 // Generate a new key pair
30 key, _ := nostr.GenerateKey()
31 fmt.Println("npub:", key.Npub())
32
33 // Create and sign an event
34 event := &nostr.Event{
35 Kind: nostr.KindTextNote,
36 Content: "Hello Nostr!",
37 }
38 event.Sign(key)
39
40 // Connect to a relay and publish
41 ctx := context.Background()
42 relay, _ := nostr.Connect(ctx, "wss://relay.damus.io")
43 defer relay.Close()
44
45 relay.Publish(ctx, event)
46}
47```
48
49## Examples
50
51See [examples/basic](examples/basic) for a complete runnable example.
52
53## Benchmarks
54
55Performance benchmarks are in [benchmarks/](benchmarks/).
56
57## License
58
59MIT