nips/63.md

1.7 KiB

NIP-63

Signed Filters

draft optional

Event kind 33012 is used to represent one or more Nostr filters.

The d tag represents the subscription id and the filter tag contains the JSON-stringified NIP-01 filter.

The optional relay tag lists the authorized relays the filter can download events from.

The optional authorized tag lists the pubkeys that are authorized to receive authed events on behalf of the user.

{
  "kind": 33012,
  "tags": [
    ["d", "<subscription_id>"],
    ["filter", "<filter1>"],
    ["filter", "<filter2>"],
    ["authorized", "<32-bytes lowercase hex of a pubkey>"], 
    ["relay", "<relay1>"],
    ["relay", "<relay2>"],
    ["expiration", "<unix timestamp>"],
  ],
  "content": "",
  // ...other fields
}

They are submitted to supporting relays via SREQ command, with the following format:

["SREQ", <kind-33012>, <kind-33012>, ...]

Supporting relays interpret the filter tags in the same way they do with REQ while automatically authenticating the signer.

Relays MUST authenticate the authorized key if present.

Relays MUST verify if they are included in the relay tag list if present.

Relays MUST comply with the expiration to limit the reuse of the filter.

Motivation

Push Notification servers can use these events to query private relays on behalf of users and push events down to mobile phones.

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).

Trusted proxies can use these event types to query relays on behalf of the user.