2024-03-30 16:57:37 -04:00
NIP-63
======
2024-03-30 17:02:13 -04:00
Signed Filters
--------------
2024-03-30 16:57:37 -04:00
`draft` `optional`
2024-03-31 11:19:41 -04:00
Event kind `33012` is used to represent one or more Nostr filters.
2024-03-30 16:57:37 -04:00
2024-03-31 11:12:59 -04:00
The `d` tag represents the subscription id and the `filter` tag contains the JSON-stringified [NIP-01 ](01.md ) filter.
2024-03-30 16:57:37 -04:00
2024-03-31 11:33:12 -04:00
The optional `relays` tag contains the destination relays the filter was designed to download events from.
The optional `authorized` pubkey contains the pubkey authorized to re-use this filter and receive events on behalf of the user.
2024-03-31 11:12:59 -04:00
```js
2024-03-30 16:57:37 -04:00
{
"kind": 33012,
"tags": [
["d", "< subscription_id > "],
2024-03-31 11:12:59 -04:00
["filter", "< filter1 > "],
["filter", "< filter2 > "],
2024-03-31 11:33:12 -04:00
["authorized", "< 32-bytes lowercase hex of a pubkey > "],
["relays", "< relay1 > ", "< relay2 > ", ...],
2024-03-31 11:12:59 -04:00
["expiration", "< unix timestamp > "],
2024-03-30 16:57:37 -04:00
],
"content": "",
2024-03-31 11:12:59 -04:00
// ...other fields
2024-03-30 16:57:37 -04:00
}
```
2024-03-31 11:12:59 -04:00
They are submitted to supporting relays via `SREQ` command, with the following format:
```js
2024-03-31 11:33:12 -04:00
["SREQ", < kind-33012 > , < kind-33012 > , ...]
2024-03-31 11:12:59 -04:00
```
2024-03-31 11:19:41 -04:00
Supporting relays interpret the `filter` tags in the same way they do with `REQ` while automatically authenticating the signer.
2024-03-31 11:12:59 -04:00
2024-03-31 11:33:12 -04:00
Supporting relays MUST authenticate the `authorized` key if present.
2024-03-31 11:12:59 -04:00
Relays MAY reject these filters based on `created_at` .
An expiration tag MAY be used to limit the reuse of the filter.
## Motivation
2024-03-31 11:33:12 -04:00
Push Notification servers can use these events to query private relays on behalf of users and push events down to mobile phones.
2024-03-30 16:57:37 -04:00
2024-03-31 11:33:12 -04:00
The goal is to be able to support `AUTH` from multiple users in the same connection. As a side effect, this approach removes the user `AUTH` round trip (but not the delegation `AUTH` ).
2024-03-30 16:57:37 -04:00
2024-03-31 11:33:12 -04:00
Trusted proxies can use these event types to query relays on behalf of the user.