This is an experimental feature, outside of any NIP, that demonstrates
generic tag queries.
Instead of limiting subscription filters to just querying only "e" or
"p" tags (via `#e` or `#p` attributes), any tag can be queried.
As an example, consider an event which uses a tag "url". With this
modification, a subscription filter could add a top-level field
"#url", with an array of strings as the key. Exact matches would be
returned.
A NIP is forthcoming to formalize this.
* Add custom error variant
This can be useful to propagate errors not conforming to available
variants. Also to convert other errors in `crate::Error` without having
explicit conversion defined, with `error.to_string()`
* Implement `Tag` and define protocol serialization
A Tag structure have been implemented with dedicated field types. Then
custom serde serialization is derived to map the structure to current
protocol json array as per NIP01.
This adds compile and run time type checking to always ensure wrong
string data are never stored or processed. With strict typed fields and
custom serde derivation this checks can be done at time of serialization,
saving work for internal handling of the actual data.
tests for possible data violations are added, and gives good example of
kind of errors it will through for different cases.
* Use String for URL
Change descr to description. Add `id` for websocket URL. Use
integers for supported NIPs instead of strings. Top-level is object,
instead of the array before.
Switched to latest (git) release of secp256k1, which has more
efficient verification-only context for Schnorr. Switched to single
pre-instantiated instance of the verifier.
This adds Hyper, and a 200 response code. Prior to this, Firefox
would fail to connect. There is also a text document displayed at the
root URL to indicate this is a Nostr relay.
Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/15
This updates the database schema to support hiding events. In this
case, we are hiding older metadata updates when an author provides an
updated event.
Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/11
The `authors` field is sufficient to represent all queries that
`author` could have been used in. See
https://github.com/fiatjaf/nostr/issues/34 for the discussion leading
to this removal.
This fixes a race condition where a publisher might send an event, and
immediately after issue a subscription for the same event ID. Prior
to this change, that event would have been published on the broadcast
channel (and ignored by our publisher, because they had not yet issued
the subscription), but not yet committed to the database. Their
subscription would trigger a database query which would return zero
results. Therefore, they would never see the event they published.
The noscl tool is one client that would suffer from this.
Now, all events are broadcast only after they exist in the database,
so a late subscription will always return the event.