diff options
| -rw-r--r-- | 01.md | 2 | ||||
| -rw-r--r-- | 26.md | 26 | ||||
| -rw-r--r-- | 56.md | 82 | ||||
| -rw-r--r-- | 65.md | 70 | ||||
| -rw-r--r-- | README.md | 43 |
5 files changed, 183 insertions, 40 deletions
| @@ -26,7 +26,7 @@ The only object type that exists is the `event`, which has the following format | |||
| 26 | ... // other kinds of tags may be included later | 26 | ... // other kinds of tags may be included later |
| 27 | ], | 27 | ], |
| 28 | "content": <arbitrary string>, | 28 | "content": <arbitrary string>, |
| 29 | "sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field> | 29 | "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> |
| 30 | } | 30 | } |
| 31 | ``` | 31 | ``` |
| 32 | 32 | ||
| @@ -38,34 +38,20 @@ The following fields and operators are supported in the above query string: | |||
| 38 | *Fields*: | 38 | *Fields*: |
| 39 | 1. `kind` | 39 | 1. `kind` |
| 40 | - *Operators*: | 40 | - *Operators*: |
| 41 | - `=${KIND_NUMBERS}` - delegatee may only sign events of listed kind(s) (comma-separated) | 41 | - `=${KIND_NUMBER}` - delegatee may only sign events of this kind |
| 42 | 2. `created_at` | 42 | 2. `created_at` |
| 43 | - *Operators*: | 43 | - *Operators*: |
| 44 | - `<${TIMESTAMP}` - delegatee may only sign events whose `created_at` is ***before*** the specified timestamp | 44 | - `<${TIMESTAMP}` - delegatee may only sign events created ***before*** the specified timestamp |
| 45 | - `>${TIMESTAMP}` - delegatee may only sign events whose `created_at` is ***after*** the specified timestamp | 45 | - `>${TIMESTAMP}` - delegatee may only sign events created ***after*** the specified timestamp |
| 46 | 46 | ||
| 47 | Multiple conditions can be used in a single query string, including on the same field. Conditions must be combined with `&`. | 47 | In order to create a single condition, you must use a supported field and operator. Multiple conditions can be used in a single query string, including on the same field. Conditions must be combined with `&`. |
| 48 | |||
| 49 | Multiple conditions should be treated as `AND` requirements; all conditions must be true for the delegated event to be valid. | ||
| 50 | |||
| 51 | Multiple comma-separated `kind` values should be interpreted as: | ||
| 52 | ``` | ||
| 53 | # kind=0,1,3000 | ||
| 54 | ... AND (kind == 0 OR kind == 1 OR kind == 3000) AND ... | ||
| 55 | ``` | ||
| 56 | 48 | ||
| 57 | For example, the following condition strings are valid: | 49 | For example, the following condition strings are valid: |
| 58 | - `kind=1` | 50 | |
| 59 | - `created_at<1675721813` | ||
| 60 | - `kind=1&created_at<1675721813` | 51 | - `kind=1&created_at<1675721813` |
| 61 | - `kind=0,1,3000&created_at>1675721813` | 52 | - `kind=0&kind=1&created_at>1675721813` |
| 62 | - `kind=1&created_at>1674777689&created_at<1675721813` | 53 | - `kind=1&created_at>1674777689&created_at<1675721813` |
| 63 | 54 | ||
| 64 | However, specifying multiple _separate_ `kind` conditions is impossible to satisfy: | ||
| 65 | - `kind=1&kind=5` | ||
| 66 | |||
| 67 | There is no way for an event to satisfy the `AND` requirement of being both `kind`s simultaneously. | ||
| 68 | |||
| 69 | For the vast majority of use-cases, it is advisable that query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf. | 55 | For the vast majority of use-cases, it is advisable that query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf. |
| 70 | 56 | ||
| 71 | #### Example | 57 | #### Example |
| @@ -0,0 +1,82 @@ | |||
| 1 | |||
| 2 | NIP-56 | ||
| 3 | ====== | ||
| 4 | |||
| 5 | Reporting | ||
| 6 | --------- | ||
| 7 | |||
| 8 | `draft` `optional` `author:jb55` | ||
| 9 | |||
| 10 | A report is a `kind 1984` note that is used to report other notes for spam, | ||
| 11 | illegal and explicit content. | ||
| 12 | |||
| 13 | The content MAY contain additional information submitted by the entity | ||
| 14 | reporting the content. | ||
| 15 | |||
| 16 | Tags | ||
| 17 | ---- | ||
| 18 | |||
| 19 | The report event MUST include a `p` tag referencing the pubkey of the user you | ||
| 20 | are reporting. | ||
| 21 | |||
| 22 | If reporting a note, an `e` tag MUST also be included referencing the note id. | ||
| 23 | |||
| 24 | A `report type` string MUST be included as the 3rd entry to the `e` or `p` tag | ||
| 25 | being reported, which consists of the following report types: | ||
| 26 | |||
| 27 | - `nudity` - depictions of nudity, porn, etc. | ||
| 28 | - `profanity` - profanity, hateful speech, etc. | ||
| 29 | - `illegal` - something which may be illegal in some jurisdiction | ||
| 30 | - `spam` - spam | ||
| 31 | - `impersonation` - someone pretending to be someone else | ||
| 32 | |||
| 33 | Some report tags only make sense for profile reports, such as `impersonation` | ||
| 34 | |||
| 35 | Example events | ||
| 36 | -------------- | ||
| 37 | |||
| 38 | ```json | ||
| 39 | { | ||
| 40 | "kind": 1984, | ||
| 41 | "tags": [ | ||
| 42 | [ "p", <pubkey>, "nudity"] | ||
| 43 | ], | ||
| 44 | "content": "", | ||
| 45 | ... | ||
| 46 | } | ||
| 47 | |||
| 48 | { | ||
| 49 | "kind": 1984, | ||
| 50 | "tags": [ | ||
| 51 | [ "e", <eventId>, "illegal"], | ||
| 52 | [ "p", <pubkey>] | ||
| 53 | ], | ||
| 54 | "content": "He's insulting the king!", | ||
| 55 | ... | ||
| 56 | } | ||
| 57 | |||
| 58 | { | ||
| 59 | "kind": 1984, | ||
| 60 | "tags": [ | ||
| 61 | [ "p", <impersonator pubkey>, "impersonation"], | ||
| 62 | [ "p", <victim pubkey>] | ||
| 63 | ], | ||
| 64 | "content": "Profile is imitating #[1]", | ||
| 65 | ... | ||
| 66 | } | ||
| 67 | ``` | ||
| 68 | |||
| 69 | Client behavior | ||
| 70 | --------------- | ||
| 71 | |||
| 72 | Clients can use reports from friends to make moderation decisions if they | ||
| 73 | choose to. For instance, if 3+ of your friends report a profile as explicit, | ||
| 74 | clients can have an option to automatically blur photos from said account. | ||
| 75 | |||
| 76 | |||
| 77 | Relay behavior | ||
| 78 | -------------- | ||
| 79 | |||
| 80 | It is not recommended that relays perform automatic moderation using reports, | ||
| 81 | as they can be easily gamed. Admins could use reports from trusted moderators to | ||
| 82 | takedown illegal or explicit content if the relay does not allow such things. | ||
| @@ -0,0 +1,70 @@ | |||
| 1 | NIP-65 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Relay List Metadata | ||
| 5 | ------------------- | ||
| 6 | |||
| 7 | `draft` `optional` `author:mikedilger` | ||
| 8 | |||
| 9 | A special replaceable event meaning "Relay List Metadata" is defined as an event with kind `10002` having a list of `r` tags, one for each relay the author uses to either read or write to. | ||
| 10 | |||
| 11 | The primary purpose of this relay list is to advertise to others, not for configuring one's client. | ||
| 12 | |||
| 13 | The content is not used and SHOULD be blank. | ||
| 14 | |||
| 15 | The `r` tags can have a second parameter as either `read` or `write`. If it is omitted, it means the author both reads from and writes to that relay. | ||
| 16 | |||
| 17 | Clients SHOULD, as with all replaceable events, use only the most recent kind-10002 event they can find. | ||
| 18 | |||
| 19 | ### The meaning of read and write | ||
| 20 | |||
| 21 | If an author advertises a write relay in a kind `10002` event, that means that feed-related events created by the author, which the author wants their followers to see, will be posted there. Normally these would be kind-1 Text Note events, but are not limited as such. | ||
| 22 | |||
| 23 | Clients SHOULD presume that if their user has a pubkey in their ContactList (kind 3) that it is because they wish to see that author's feed-related events. But clients MAY presume otherwise. | ||
| 24 | |||
| 25 | If an author advertises a read relay in a kind `10002` event, that means that the author may be subscribed to events that tag them on such relays. Clients SHOULD publish events that tag someone on at least some of the read relays of the person being tagged. | ||
| 26 | |||
| 27 | ### Motivation | ||
| 28 | |||
| 29 | There is a common nostr use case where users wish to follow the content produced by other users. This is evidenced by the implicit meaning of the Contact List in [NIP-02](02.md) | ||
| 30 | |||
| 31 | Because users don't often share the same sets of relays, ad-hoc solutions have arisen to get that content, but these solutions negatively impact scalability and decentralization: | ||
| 32 | |||
| 33 | - Most people are sending their posts to the same most popular relays in order to be more widely seen | ||
| 34 | - Many people are pulling from a large number of relays (including many duplicate events) in order to get more data | ||
| 35 | - Events are being copied between relays, oftentimes to many different relays | ||
| 36 | |||
| 37 | ### Purposes | ||
| 38 | |||
| 39 | The purpose of this NIP is to help clients find the events of the people they follow, to help tagged events get to the people tagged, and to help nostr scale better. | ||
| 40 | |||
| 41 | ### Suggestions | ||
| 42 | |||
| 43 | It is suggested that people spread their kind `10002` events to many relays, but write their normal feed-related events to a much smaller number of relays (between 2 to 6 relays). It is suggested that clients offer a way for users to spread their kind `10002` events to many more relays than they normally post to. | ||
| 44 | |||
| 45 | Authors may post events outside of the feed that they wish their followers to follow by posting them to relays outside of those listed in their "Relay List Metadata". For example, an author may want to reply to someone without all of their followers watching. | ||
| 46 | |||
| 47 | It is suggested that relays allow any user to write their own kind `10002` event (optionally with AUTH to verify it is their own) even if they are not otherwise subscribed to the relay because | ||
| 48 | |||
| 49 | - finding where someone posts is rather important | ||
| 50 | - these events do not have content that needs management | ||
| 51 | - relays only need to store one replaceable event per pubkey to offer this service | ||
| 52 | |||
| 53 | ### Why not in kind `0` Metadata | ||
| 54 | |||
| 55 | Even though this is user related metadata, it is a separate event from kind `0` in order to keep it small (as it should be widely spread) and to not have content that may require moderation by relay operators so that it is more acceptable to relays. | ||
| 56 | |||
| 57 | ### Example | ||
| 58 | |||
| 59 | ```json | ||
| 60 | { | ||
| 61 | "kind": 10002, | ||
| 62 | "tags": [ | ||
| 63 | ["r", "wss://alicerelay.example.com"], | ||
| 64 | ["r", "wss://brando-relay.com"], | ||
| 65 | ["r", "wss://expensive-relay.example2.com", "write"], | ||
| 66 | ["r", "wss://nostr-relay.example.com", "read"], | ||
| 67 | ], | ||
| 68 | "content": "", | ||
| 69 | ...other fields | ||
| 70 | ``` | ||
| @@ -30,28 +30,33 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh | |||
| 30 | - [NIP-40: Expiration Timestamp](40.md) | 30 | - [NIP-40: Expiration Timestamp](40.md) |
| 31 | - [NIP-42: Authentication of clients to relays](42.md) | 31 | - [NIP-42: Authentication of clients to relays](42.md) |
| 32 | - [NIP-50: Keywords filter](50.md) | 32 | - [NIP-50: Keywords filter](50.md) |
| 33 | - [NIP-56: Reporting](56.md) | ||
| 34 | - [NIP-65: Relay List Metadata](65.md) | ||
| 33 | 35 | ||
| 34 | ## Event Kinds | 36 | ## Event Kinds |
| 35 | 37 | ||
| 36 | | kind | description | NIP | | 38 | | kind | description | NIP | |
| 37 | |-------------|-----------------------------|------------------------| | 39 | | ------------- | -------------------------------- | ----------------------- | |
| 38 | | 0 | Metadata | [1](01.md), [5](05.md) | | 40 | | 0 | Metadata | [1](01.md), [5](05.md) | |
| 39 | | 1 | Text | [1](01.md) | | 41 | | 1 | Short Text Note | [1](01.md) | |
| 40 | | 2 | Recommend Relay | [1](01.md) | | 42 | | 2 | Recommend Relay | [1](01.md) | |
| 41 | | 3 | Contacts | [2](02.md) | | 43 | | 3 | Contacts | [2](02.md) | |
| 42 | | 4 | Encrypted Direct Messages | [4](04.md) | | 44 | | 4 | Encrypted Direct Messages | [4](04.md) | |
| 43 | | 5 | Event Deletion | [9](09.md) | | 45 | | 5 | Event Deletion | [9](09.md) | |
| 44 | | 7 | Reaction | [25](25.md) | | 46 | | 7 | Reaction | [25](25.md) | |
| 45 | | 40 | Channel Creation | [28](28.md) | | 47 | | 40 | Channel Creation | [28](28.md) | |
| 46 | | 41 | Channel Metadata | [28](28.md) | | 48 | | 41 | Channel Metadata | [28](28.md) | |
| 47 | | 42 | Channel Message | [28](28.md) | | 49 | | 42 | Channel Message | [28](28.md) | |
| 48 | | 43 | Channel Hide Message | [28](28.md) | | 50 | | 43 | Channel Hide Message | [28](28.md) | |
| 49 | | 44 | Channel Mute User | [28](28.md) | | 51 | | 44 | Channel Mute User | [28](28.md) | |
| 50 | | 45-49 | Public Chat Reserved | [28](28.md) | | 52 | | 45-49 | Public Chat Reserved | [28](28.md) | |
| 51 | | 22242 | Client Authentication | [42](42.md) | | 53 | | 1984 | Reporting | [56](56.md) | |
| 52 | | 10000-19999 | Replaceable Events Reserved | [16](16.md) | | 54 | | 10002 | Relay List Metadata | [65](65.md) | |
| 53 | | 20000-29999 | Ephemeral Events Reserved | [16](16.md) | | 55 | | 22242 | Client Authentication | [42](42.md) | |
| 54 | | 30000-39999 | Param. Repl. Events Reserved| [33](33.md) | | 56 | | 1000-9999 | Regular Events | [16](16.md) | |
| 57 | | 10000-19999 | Replaceable Events | [16](16.md) | | ||
| 58 | | 20000-29999 | Ephemeral Events | [16](16.md) | | ||
| 59 | | 30000-39999 | Parameterized Replaceable Events | [33](33.md) | | ||
| 55 | 60 | ||
| 56 | 61 | ||
| 57 | 62 | ||