diff options
Diffstat (limited to 'website')
| -rw-r--r-- | website/index.html | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/website/index.html b/website/index.html new file mode 100644 index 0000000..a4a9f94 --- /dev/null +++ b/website/index.html | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | <!DOCTYPE html> | ||
| 2 | <html lang="en"> | ||
| 3 | <head> | ||
| 4 | <meta charset="UTF-8"> | ||
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 6 | <meta name="description" content="A minimal Go library for Nostr. 1 dependency."> | ||
| 7 | <meta name="go-import" content="code.northwest.io/nostr git https://code.northwest.io/nostr.git"> | ||
| 8 | <title>nostr — minimal Go library</title> | ||
| 9 | <style> | ||
| 10 | :root { | ||
| 11 | --bg: #f5f2eb; | ||
| 12 | --fg: #2c2c2c; | ||
| 13 | --muted: #6b6b6b; | ||
| 14 | --border: #d4d0c8; | ||
| 15 | --code-bg: #eae7e0; | ||
| 16 | } | ||
| 17 | |||
| 18 | @media (prefers-color-scheme: dark) { | ||
| 19 | :root { | ||
| 20 | --bg: #1c1c1c; | ||
| 21 | --fg: #e8e4dc; | ||
| 22 | --muted: #888; | ||
| 23 | --border: #333; | ||
| 24 | --code-bg: #252525; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | * { | ||
| 29 | box-sizing: border-box; | ||
| 30 | margin: 0; | ||
| 31 | padding: 0; | ||
| 32 | } | ||
| 33 | |||
| 34 | body { | ||
| 35 | font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace; | ||
| 36 | font-size: 15px; | ||
| 37 | line-height: 1.6; | ||
| 38 | background: var(--bg); | ||
| 39 | color: var(--fg); | ||
| 40 | padding: 3rem 1.5rem; | ||
| 41 | max-width: 680px; | ||
| 42 | margin: 0 auto; | ||
| 43 | } | ||
| 44 | |||
| 45 | h1 { | ||
| 46 | font-size: 1.5rem; | ||
| 47 | font-weight: 600; | ||
| 48 | margin-bottom: 0.5rem; | ||
| 49 | } | ||
| 50 | |||
| 51 | .tagline { | ||
| 52 | color: var(--muted); | ||
| 53 | margin-bottom: 2rem; | ||
| 54 | } | ||
| 55 | |||
| 56 | .install { | ||
| 57 | background: var(--code-bg); | ||
| 58 | padding: 0.75rem 1rem; | ||
| 59 | border: 1px solid var(--border); | ||
| 60 | margin-bottom: 2.5rem; | ||
| 61 | font-size: 14px; | ||
| 62 | } | ||
| 63 | |||
| 64 | h2 { | ||
| 65 | font-size: 1rem; | ||
| 66 | font-weight: 600; | ||
| 67 | margin-top: 2rem; | ||
| 68 | margin-bottom: 0.75rem; | ||
| 69 | color: var(--muted); | ||
| 70 | text-transform: uppercase; | ||
| 71 | letter-spacing: 0.05em; | ||
| 72 | } | ||
| 73 | |||
| 74 | p { | ||
| 75 | margin-bottom: 1rem; | ||
| 76 | } | ||
| 77 | |||
| 78 | ul { | ||
| 79 | list-style: none; | ||
| 80 | margin-bottom: 1.5rem; | ||
| 81 | } | ||
| 82 | |||
| 83 | li { | ||
| 84 | padding-left: 1rem; | ||
| 85 | position: relative; | ||
| 86 | margin-bottom: 0.25rem; | ||
| 87 | } | ||
| 88 | |||
| 89 | li::before { | ||
| 90 | content: "—"; | ||
| 91 | position: absolute; | ||
| 92 | left: 0; | ||
| 93 | color: var(--muted); | ||
| 94 | } | ||
| 95 | |||
| 96 | pre { | ||
| 97 | background: var(--code-bg); | ||
| 98 | padding: 1rem; | ||
| 99 | border: 1px solid var(--border); | ||
| 100 | overflow-x: auto; | ||
| 101 | font-size: 13px; | ||
| 102 | margin-bottom: 1.5rem; | ||
| 103 | } | ||
| 104 | |||
| 105 | code { | ||
| 106 | font-family: inherit; | ||
| 107 | } | ||
| 108 | |||
| 109 | a { | ||
| 110 | color: var(--fg); | ||
| 111 | text-decoration: underline; | ||
| 112 | text-underline-offset: 2px; | ||
| 113 | } | ||
| 114 | |||
| 115 | a:hover { | ||
| 116 | color: var(--muted); | ||
| 117 | } | ||
| 118 | |||
| 119 | .dep { | ||
| 120 | background: var(--code-bg); | ||
| 121 | padding: 0.5rem 0.75rem; | ||
| 122 | border: 1px solid var(--border); | ||
| 123 | display: inline-block; | ||
| 124 | font-size: 13px; | ||
| 125 | margin-bottom: 1.5rem; | ||
| 126 | } | ||
| 127 | |||
| 128 | footer { | ||
| 129 | margin-top: 3rem; | ||
| 130 | padding-top: 1.5rem; | ||
| 131 | border-top: 1px solid var(--border); | ||
| 132 | color: var(--muted); | ||
| 133 | font-size: 13px; | ||
| 134 | } | ||
| 135 | |||
| 136 | footer a { | ||
| 137 | color: var(--muted); | ||
| 138 | } | ||
| 139 | </style> | ||
| 140 | </head> | ||
| 141 | <body> | ||
| 142 | <h1>nostr</h1> | ||
| 143 | <p class="tagline">A minimal Go library for the Nostr protocol.</p> | ||
| 144 | |||
| 145 | <div class="install">go get code.northwest.io/nostr</div> | ||
| 146 | |||
| 147 | <h2>Why</h2> | ||
| 148 | <p><strong>1 dependency.</strong> Other Nostr libraries pull in 30+. This one has exactly one:</p> | ||
| 149 | <div class="dep">btcec/v2 — Schnorr signatures (required by protocol)</div> | ||
| 150 | <p>No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol, stdlib only.</p> | ||
| 151 | |||
| 152 | <h2>What's Included</h2> | ||
| 153 | <ul> | ||
| 154 | <li><strong>Keys</strong> — generate, parse, sign, verify (hex + bech32)</li> | ||
| 155 | <li><strong>Events</strong> — create, serialize, sign NIP-01 events</li> | ||
| 156 | <li><strong>Filters</strong> — build and match subscription filters</li> | ||
| 157 | <li><strong>Relay</strong> — WebSocket pub/sub (stdlib net/http)</li> | ||
| 158 | <li><strong>Tags</strong> — parse and build event tags</li> | ||
| 159 | <li><strong>Envelopes</strong> — protocol message parsing</li> | ||
| 160 | </ul> | ||
| 161 | |||
| 162 | <h2>Example</h2> | ||
| 163 | <pre><code>key, _ := nostr.GenerateKey() | ||
| 164 | fmt.Println("npub:", key.Npub()) | ||
| 165 | |||
| 166 | event := &nostr.Event{ | ||
| 167 | Kind: nostr.KindTextNote, | ||
| 168 | Content: "Hello Nostr!", | ||
| 169 | } | ||
| 170 | event.Sign(key) | ||
| 171 | |||
| 172 | relay, _ := nostr.Connect(ctx, "wss://relay.damus.io") | ||
| 173 | relay.Publish(ctx, event)</code></pre> | ||
| 174 | |||
| 175 | <h2>What's Not Included</h2> | ||
| 176 | <p>This is a minimal core library. It implements NIP-01 and the basics. It doesn't implement every NIP, handle connection pooling, or manage relay discovery. Build that yourself, or don't.</p> | ||
| 177 | |||
| 178 | <footer> | ||
| 179 | <a href="https://code.northwest.io/nostr">source</a> · MIT | ||
| 180 | </footer> | ||
| 181 | </body> | ||
| 182 | </html> | ||
