mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-06 21:19:28 +02:00
update example in README.
This commit is contained in:
parent
fabd5160a8
commit
e73b784501
25
README.md
25
README.md
@ -101,8 +101,7 @@ for _, url := range []string{"wss://nostr.zebedee.cloud", "wss://nostr-pub.wello
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
_, err = relay.Publish(ctx, ev)
|
||||
if err != nil {
|
||||
if err := relay.Publish(ctx, ev); err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
@ -111,28 +110,6 @@ for _, url := range []string{"wss://nostr.zebedee.cloud", "wss://nostr-pub.wello
|
||||
}
|
||||
```
|
||||
|
||||
### Authenticating with NIP-42
|
||||
|
||||
For this section, the user needs access to a relay implementing NIP-42.
|
||||
E.g., https://github.com/fiatjaf/relayer with a relay implementing the relayer.Auther interface.
|
||||
|
||||
``` go
|
||||
func main() {
|
||||
url := "ws://localhost:7447"
|
||||
|
||||
sk := nostr.GeneratePrivateKey()
|
||||
|
||||
relay, err := nostr.RelayConnect(context.Background(), url,
|
||||
nostr.WithAuthHandler(func(ctx context.Context, authEvent *Event) (ok bool) {
|
||||
authEvent.Sign(sk)
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example script
|
||||
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user