Commit Graph

72 Commits

Author SHA1 Message Date
fiatjaf 69ccfbaa08 protect against faulty relays that send more than one EOSE halting us
using sync.Once{} to only emit to the EndOfStoredEvents channel once
(it has capacity 1 so anything over that would halt).
2022-11-16 10:07:37 -03:00
fiatjaf 7538f1108d stop halting at EOSE. 2022-11-16 10:05:28 -03:00
fiatjaf 14e81a756a fix unique logic (move it to a helper function, we can't return two channels because that will break if the caller doesn't read from both.) 2022-11-15 16:40:17 -03:00
fiatjaf 2ec7957409 fix nip19 bech32 encoding and decoding. 2022-11-15 16:29:37 -03:00
fiatjaf dd0571229b RelayConnect() ensures there will be a connection, and handle connection errors better. 2022-11-15 07:53:50 -03:00
fiatjaf 2b8807d699 fix relay .Connect() and .Sub() 2022-11-14 19:48:02 -03:00
fiatjaf 37235a1394 bring back unique events. 2022-11-13 19:33:48 -03:00
fiatjaf 2641327c28 support for EOSE and OK messages on relay/subscription. 2022-11-12 21:49:57 -03:00
fiatjaf 50e47392a9 improve tags godoc. 2022-11-11 10:56:17 -03:00
fiatjaf 8a12bb2c18 some helper functions for tags. 2022-11-11 10:52:23 -03:00
Blake Jakopovic cdc9b61db1 Update example.go
Fixed a typo and capitalised
2022-11-09 13:20:18 -03:00
fiatjaf fe01c9474b fix string formatting on test errors. 2022-11-08 08:44:22 -03:00
fiatjaf f98f54d3be use generic functions for dealing with lists. 2022-11-08 07:15:08 -03:00
fiatjaf c4d52e516f change relaypool and subscription such that a Relay can have an independent existence. 2022-11-06 21:15:42 -03:00
fiatjaf 2427dbd65a rename to github.com/nbd-wtf/go-nostr 2022-11-04 08:24:32 -03:00
fiatjaf 329b8d44d2 move stuff back from nostr package to top level.
because otherwise the path must be specified as github.com/fiatjaf/go-nostr/nostr, which is annoying.
2022-11-04 08:22:13 -03:00
fiatjaf 3a6d6795e4 add an "extra" map to events that can be used to merge other properties when necessary. 2022-11-04 08:21:35 -03:00
fiatjaf fb3972b725 add new event kinds. 2022-11-04 08:03:17 -03:00
fiatjaf 7de8bcd2d0 basic support for nip19. 2022-10-31 14:57:49 -03:00
BitcoinCoderBob 9549c3624a nostr package, readme updates accordingly, matching example program (#14) 2022-10-12 17:24:30 -03:00
dolcea@lenovo e47c80a63d Handle Filter.Limit 2022-10-11 13:58:29 -03:00
Santos Hernandez e546214291 added nbd badge 2022-10-07 18:51:36 -07:00
Santos Hernandez 5276359774 Rename LICENSE to LICENSE.md 2022-10-07 16:52:01 -07:00
Santos Hernandez 01a4034add Create LICENSE 2022-10-07 16:51:17 -07:00
fiatjaf cea3004867 update to go1.18 and use generic sync maps instead of normal maps.
fixes https://github.com/fiatjaf/go-nostr/issues/12
2022-08-22 08:45:39 -03:00
fiatjaf 2f84ddf5f5 add limit field to filter. 2022-07-24 19:53:10 -03:00
fiatjaf 66aa4e9de2 add nip-11 type. 2022-07-11 15:51:24 -03:00
fiatjaf 1f1d3cfe7f some changes and fixes related to sub.Sub(). 2022-05-04 12:39:10 -03:00
fiatjaf 5f3221e966 nip05 queryName() function. 2022-05-04 11:15:31 -03:00
fiatjaf 5d1a29d135 stop closing publishstatus connection and subscriptions.
I'm not sure about this but it seems to work better this way.
2022-05-01 21:11:46 -03:00
fiatjaf 16c874cb8d add String() method to Status int on PublishStatus. 2022-05-01 17:51:46 -03:00
fiatjaf a11aa8756b fix CheckSignature(): we were parsing the pubkey with the ECDSA function instead of Schnorr. 2022-05-01 17:51:16 -03:00
fiatjaf 00ad1acde9 use schnorr from btcec instead of the bip340 library. 2022-05-01 15:10:18 -03:00
Gustavo Chain c0a2be91a1 relaypool: continue on ping msg 2022-02-19 08:33:29 -03:00
fiatjaf dd43f4c495 add another event to serialization and verification test. 2022-02-14 10:18:50 -03:00
fiatjaf a563c5faa1 fix subarray length typo. 2022-02-13 16:31:44 -03:00
fiatjaf acf86e9ad8 filenames starting with "aux" break things because something on windows? 2022-02-12 20:32:48 -03:00
fiatjaf 795863d2dd alias TagMap to map[string]StringList. 2022-02-09 20:25:23 -03:00
fiatjaf 9721ffa851 use fastjson to serialize and unmarshal/marshal events, remove need for special Time type. 2022-02-09 20:23:10 -03:00
fiatjaf 41955a0601 serialization tests for events and filters. 2022-02-09 13:40:26 -03:00
fiatjaf 5266482b2a support prefix search for ids and authors (nip01 update). 2022-02-08 16:44:33 -03:00
fiatjaf 86853004ef change parsing so NIP12 can work, rename types. 2022-02-08 16:27:33 -03:00
fiatjaf ef1f548212 avoid sending to closed Events/UniqueEvents channels. 2022-02-07 11:33:45 -03:00
raphael 7760f53ce2 Adding nip04 (encrypted direct messages) support (#8)
* implementing encrypted direct messages

* added encrypted direct message support

Co-authored-by: Raphael <raphjaph@protonmail.com>
2022-02-06 10:16:09 -03:00
fiatjaf c54ddab07d fix README on generating keys. 2022-01-23 15:23:55 -03:00
Honza Pokorny a3df2cb893 Add mutexes around websockets
We replace the bare websocket.Conn type with a new Connection type which
implements `WriteJSON`, `WriteMessage`, and `Close`.  The Connection
type adds mutexes around writes since gorilla doesn't support concurrent
writes to websockets.

Signed-off-by: Honza Pokorny <honza@pokorny.ca>
2022-01-12 12:19:33 -03:00
fiatjaf ba0507cce7 nip06 package for key derivation. 2022-01-06 21:57:04 -03:00
fiatjaf 275020a7ef just some basic bip340 key functions instead. 2022-01-06 08:24:20 -03:00
Honza Pokorny 8558025305 Add key-related functions 2022-01-06 07:39:04 -03:00
Honza Pokorny 26c3b4aac9 Remove unnecessary argument to subscription.Sub
The `Sub()` function retrieves the list of filters from the
`Subscripton` object itself, and therefore it's unnecessary to pass it
in.  The argument is unused.

Here, we remove the function argument from the definition, and from the
single call site.  We then pass the filters to the initializer.

This makes it so that filters are in fact passed to the relay on the wire.
2022-01-04 12:24:05 -03:00