diff options
| author | fiatjaf_ <fiatjaf@gmail.com> | 2025-05-14 09:27:59 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-14 09:27:59 -0300 |
| commit | 553c1c77c004329206a3ba851f3a68367d9edc9a (patch) | |
| tree | b09cc1eeda90001fb5cdf91573d15dd721c338af /52.md | |
| parent | 7555a93f902277d18f3e0faf2535a15e0e3b9f50 (diff) | |
simplify nip-52 (#1922)
Diffstat (limited to '52.md')
| -rw-r--r-- | 52.md | 119 |
1 files changed, 45 insertions, 74 deletions
| @@ -12,23 +12,14 @@ Unlike the term `calendar event` specific to this NIP, the term `event` is used | |||
| 12 | 12 | ||
| 13 | ## Calendar Events | 13 | ## Calendar Events |
| 14 | 14 | ||
| 15 | There are two types of calendar events represented by different kinds: date-based and time-based calendar events. Calendar events are not required to be part of a [calendar](#calendar). | 15 | There are two types of calendar events represented by different kinds: _date-based_ and _time-based_ calendar events. |
| 16 | 16 | ||
| 17 | ### Date-Based Calendar Event | 17 | These tags are common to both types of calendar events: |
| 18 | |||
| 19 | This kind of calendar event starts on a date and ends before a different date in the future. Its use is appropriate for all-day or multi-day events where time and time zone hold no significance. e.g., anniversary, public holidays, vacation days. | ||
| 20 | |||
| 21 | #### Format | ||
| 22 | |||
| 23 | The format uses an _addressable event_ of `kind:31922`. | ||
| 24 | |||
| 25 | The `.content` of these events should be a detailed description of the calendar event. It is required but can be an empty string. | ||
| 26 | 18 | ||
| 27 | The list of tags are as follows: | ||
| 28 | * `d` (required) a short unique string identifier. Generated by the client creating the calendar event. | 19 | * `d` (required) a short unique string identifier. Generated by the client creating the calendar event. |
| 29 | * `title` (required) title of the calendar event | 20 | * `title` (required) title of the calendar event |
| 30 | * `start` (required) inclusive start date in ISO 8601 format (YYYY-MM-DD). Must be less than `end`, if it exists. | 21 | * `summary` (optional) brief description of the calendar event |
| 31 | * `end` (optional) exclusive end date in ISO 8601 format (YYYY-MM-DD). If omitted, the calendar event ends on the same date as `start`. | 22 | * `image` (optional) url of an image to use for the event |
| 32 | * `location` (optional, repeated) location of the calendar event. e.g. address, GPS coordinates, meeting room name, link to video call | 23 | * `location` (optional, repeated) location of the calendar event. e.g. address, GPS coordinates, meeting room name, link to video call |
| 33 | * `g` (optional) [geohash](https://en.wikipedia.org/wiki/Geohash) to associate calendar event with a searchable physical location | 24 | * `g` (optional) [geohash](https://en.wikipedia.org/wiki/Geohash) to associate calendar event with a searchable physical location |
| 34 | * `p` (optional, repeated) 32-bytes hex pubkey of a participant, optional recommended relay URL, and participant's role in the meeting | 25 | * `p` (optional, repeated) 32-bytes hex pubkey of a participant, optional recommended relay URL, and participant's role in the meeting |
| @@ -36,13 +27,31 @@ The list of tags are as follows: | |||
| 36 | * `r` (optional, repeated) references / links to web pages, documents, video calls, recorded videos, etc. | 27 | * `r` (optional, repeated) references / links to web pages, documents, video calls, recorded videos, etc. |
| 37 | 28 | ||
| 38 | The following tags are deprecated: | 29 | The following tags are deprecated: |
| 30 | |||
| 39 | * `name` name of the calendar event. Use only if `title` is not available. | 31 | * `name` name of the calendar event. Use only if `title` is not available. |
| 40 | 32 | ||
| 41 | ```jsonc | 33 | Calendar events are _not_ required to be part of a [calendar](#calendar). |
| 34 | |||
| 35 | ### Date-Based Calendar Event | ||
| 36 | |||
| 37 | This kind of calendar event starts on a date and ends before a different date in the future. Its use is appropriate for all-day or multi-day events where time and time zone hold no significance. e.g., anniversary, public holidays, vacation days. | ||
| 38 | |||
| 39 | It's an _addressable event_ of `kind:31922`. | ||
| 40 | |||
| 41 | The `.content` of these events SHOULD be a description of the calendar event. | ||
| 42 | |||
| 43 | Aside from the common tags, this also takes the following tags: | ||
| 44 | |||
| 45 | * `start` (required) inclusive start date in ISO 8601 format (YYYY-MM-DD). Must be less than `end`, if it exists. | ||
| 46 | * `end` (optional) exclusive end date in ISO 8601 format (YYYY-MM-DD). If omitted, the calendar event ends on the same date as `start`. | ||
| 47 | |||
| 48 | Example: | ||
| 49 | |||
| 50 | ```yaml | ||
| 42 | { | 51 | { |
| 43 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, | 52 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, |
| 44 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, | 53 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, |
| 45 | "created_at": <Unix timestamp in seconds>, | 54 | "created_at": <unix timestamp in seconds>, |
| 46 | "kind": 31922, | 55 | "kind": 31922, |
| 47 | "content": "<description of calendar event>", | 56 | "content": "<description of calendar event>", |
| 48 | "tags": [ | 57 | "tags": [ |
| @@ -50,25 +59,17 @@ The following tags are deprecated: | |||
| 50 | 59 | ||
| 51 | ["title", "<title of calendar event>"], | 60 | ["title", "<title of calendar event>"], |
| 52 | 61 | ||
| 53 | // Dates | 62 | // dates |
| 54 | ["start", "<YYYY-MM-DD>"], | 63 | ["start", "<YYYY-MM-DD>"], |
| 55 | ["end", "<YYYY-MM-DD>"], | 64 | ["end", "<YYYY-MM-DD>"], |
| 56 | 65 | ||
| 57 | // Location | 66 | // location |
| 58 | ["location", "<location>"], | 67 | ["location", "<location>"], |
| 59 | ["g", "<geohash>"], | 68 | ["g", "<geohash>"], |
| 60 | 69 | ||
| 61 | // Participants | 70 | // participants |
| 62 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], | 71 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], |
| 63 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], | 72 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], |
| 64 | |||
| 65 | // Hashtags | ||
| 66 | ["t", "<tag>"], | ||
| 67 | ["t", "<tag>"], | ||
| 68 | |||
| 69 | // Reference links | ||
| 70 | ["r", "<url>"], | ||
| 71 | ["r", "<url>"] | ||
| 72 | ] | 73 | ] |
| 73 | } | 74 | } |
| 74 | ``` | 75 | ``` |
| @@ -77,36 +78,22 @@ The following tags are deprecated: | |||
| 77 | 78 | ||
| 78 | This kind of calendar event spans between a start time and end time. | 79 | This kind of calendar event spans between a start time and end time. |
| 79 | 80 | ||
| 80 | #### Format | 81 | It's an _addressable event_ of `kind:31923`. |
| 81 | 82 | ||
| 82 | The format uses an _addressable event_ kind `31923`. | 83 | The `.content` of these events should be a description of the calendar event. It is required but can be an empty string. |
| 83 | 84 | ||
| 84 | The `.content` of these events should be a detailed description of the calendar event. It is required but can be an empty string. | 85 | Aside from the common tags, this also takes the following tags: |
| 85 | 86 | ||
| 86 | The list of tags are as follows: | ||
| 87 | * `d` (required) a short unique string identifier. Generated by the client creating the calendar event. | ||
| 88 | * `title` (required) title of the calendar event | ||
| 89 | * `start` (required) inclusive start Unix timestamp in seconds. Must be less than `end`, if it exists. | 87 | * `start` (required) inclusive start Unix timestamp in seconds. Must be less than `end`, if it exists. |
| 90 | * `end` (optional) exclusive end Unix timestamp in seconds. If omitted, the calendar event ends instantaneously. | 88 | * `end` (optional) exclusive end Unix timestamp in seconds. If omitted, the calendar event ends instantaneously. |
| 91 | * `start_tzid` (optional) time zone of the start timestamp, as defined by the IANA Time Zone Database. e.g., `America/Costa_Rica` | 89 | * `start_tzid` (optional) time zone of the start timestamp, as defined by the IANA Time Zone Database. e.g., `America/Costa_Rica` |
| 92 | * `end_tzid` (optional) time zone of the end timestamp, as defined by the IANA Time Zone Database. e.g., `America/Costa_Rica`. If omitted and `start_tzid` is provided, the time zone of the end timestamp is the same as the start timestamp. | 90 | * `end_tzid` (optional) time zone of the end timestamp, as defined by the IANA Time Zone Database. e.g., `America/Costa_Rica`. If omitted and `start_tzid` is provided, the time zone of the end timestamp is the same as the start timestamp. |
| 93 | * `summary` (optional) brief description of the calendar event | ||
| 94 | * `image` (optional) url of an image to use for the event | ||
| 95 | * `location` (optional, repeated) location of the calendar event. e.g. address, GPS coordinates, meeting room name, link to video call | ||
| 96 | * `g` (optional) [geohash](https://en.wikipedia.org/wiki/Geohash) to associate calendar event with a searchable physical location | ||
| 97 | * `p` (optional, repeated) 32-bytes hex pubkey of a participant, optional recommended relay URL, and participant's role in the meeting | ||
| 98 | * `l` (optional, repeated) label to categorize calendar event. e.g. `audiospace` to denote a scheduled event from a live audio space implementation such as cornychat.com | ||
| 99 | * `t` (optional, repeated) hashtag to categorize calendar event | ||
| 100 | * `r` (optional, repeated) references / links to web pages, documents, video calls, recorded videos, etc. | ||
| 101 | 91 | ||
| 102 | The following tags are deprecated: | 92 | ```yaml |
| 103 | * `name` name of the calendar event. Use only if `title` is not available. | ||
| 104 | |||
| 105 | ```jsonc | ||
| 106 | { | 93 | { |
| 107 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, | 94 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, |
| 108 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, | 95 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, |
| 109 | "created_at": <Unix timestamp in seconds>, | 96 | "created_at": <unix timestamp in seconds>, |
| 110 | "kind": 31923, | 97 | "kind": 31923, |
| 111 | "content": "<description of calendar event>", | 98 | "content": "<description of calendar event>", |
| 112 | "tags": [ | 99 | "tags": [ |
| @@ -116,54 +103,39 @@ The following tags are deprecated: | |||
| 116 | ["summary", "<brief description of the calendar event>"], | 103 | ["summary", "<brief description of the calendar event>"], |
| 117 | ["image", "<string with image URI>"], | 104 | ["image", "<string with image URI>"], |
| 118 | 105 | ||
| 119 | // Timestamps | 106 | // timestamps |
| 120 | ["start", "<Unix timestamp in seconds>"], | 107 | ["start", "<unix timestamp in seconds>"], |
| 121 | ["end", "<Unix timestamp in seconds>"], | 108 | ["end", "<unix timestamp in seconds>"], |
| 122 | 109 | ||
| 123 | ["start_tzid", "<IANA Time Zone Database identifier>"], | 110 | ["start_tzid", "<IANA Time Zone Database identifier>"], |
| 124 | ["end_tzid", "<IANA Time Zone Database identifier>"], | 111 | ["end_tzid", "<IANA Time Zone Database identifier>"], |
| 125 | 112 | ||
| 126 | // Location | 113 | // location |
| 127 | ["location", "<location>"], | 114 | ["location", "<location>"], |
| 128 | ["g", "<geohash>"], | 115 | ["g", "<geohash>"], |
| 129 | 116 | ||
| 130 | // Participants | 117 | // participants |
| 131 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], | 118 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], |
| 132 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], | 119 | ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "<role>"], |
| 133 | |||
| 134 | // Labels (example using com.cornychat namespace denoting the event as an audiospace) | ||
| 135 | ["L", "com.cornychat"], | ||
| 136 | ["l", "audiospace", "com.cornychat"], | ||
| 137 | |||
| 138 | // Hashtags | ||
| 139 | ["t", "<tag>"], | ||
| 140 | ["t", "<tag>"], | ||
| 141 | |||
| 142 | // Reference links | ||
| 143 | ["r", "<url>"], | ||
| 144 | ["r", "<url>"] | ||
| 145 | ] | 120 | ] |
| 146 | } | 121 | } |
| 147 | ``` | 122 | ``` |
| 148 | 123 | ||
| 149 | ## Calendar | 124 | ## Calendar |
| 150 | 125 | ||
| 151 | A calendar is a collection of calendar events, represented as a custom replaceable list event using kind `31924`. A user can have multiple calendars. One may create a calendar to segment calendar events for specific purposes. e.g., personal, work, travel, meetups, and conferences. | 126 | A calendar is a collection of calendar events, represented as a custom _addressable list_ event using kind `31924`. A user can have multiple calendars. One may create a calendar to segment calendar events for specific purposes. e.g., personal, work, travel, meetups, and conferences. |
| 152 | |||
| 153 | ### Format | ||
| 154 | 127 | ||
| 155 | The `.content` of these events should be a detailed description of the calendar. It is required but can be an empty string. | 128 | The `.content` of these events should be a detailed description of the calendar. It is required but can be an empty string. |
| 156 | 129 | ||
| 157 | The format uses a custom replaceable list of kind `31924` with a list of tags as described below: | ||
| 158 | * `d` (required) universally unique identifier. Generated by the client creating the calendar. | 130 | * `d` (required) universally unique identifier. Generated by the client creating the calendar. |
| 159 | * `title` (required) calendar title | 131 | * `title` (required) calendar title |
| 160 | * `a` (repeated) reference tag to kind `31922` or `31923` calendar event being responded to | 132 | * `a` (repeated) reference tag to kind `31922` or `31923` calendar event being responded to |
| 161 | 133 | ||
| 162 | ```json | 134 | ```yaml |
| 163 | { | 135 | { |
| 164 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, | 136 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, |
| 165 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, | 137 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, |
| 166 | "created_at": <Unix timestamp in seconds>, | 138 | "created_at": <unix timestamp in seconds>, |
| 167 | "kind": 31924, | 139 | "kind": 31924, |
| 168 | "content": "<description of calendar>", | 140 | "content": "<description of calendar>", |
| 169 | "tags": [ | 141 | "tags": [ |
| @@ -191,13 +163,12 @@ The RSVP MUST have an `a` tag of the event coordinates to the calendar event, an | |||
| 191 | 163 | ||
| 192 | The RSVP MAY tag the author of the calendar event it is in response to using a `p` tag so that clients can easily query all RSVPs that pertain to the author. | 164 | The RSVP MAY tag the author of the calendar event it is in response to using a `p` tag so that clients can easily query all RSVPs that pertain to the author. |
| 193 | 165 | ||
| 194 | ### Format | 166 | The RSVP is an _addressable event_ of `kind:31925`. |
| 195 | |||
| 196 | The format uses an _addressable event_ kind `31925`. | ||
| 197 | 167 | ||
| 198 | The `.content` of these events is optional and should be a free-form note that adds more context to this calendar event response. | 168 | The `.content` of these events is optional and should be a free-form note that adds more context to this calendar event response. |
| 199 | 169 | ||
| 200 | The list of tags are as follows: | 170 | The list of tags is as follows: |
| 171 | |||
| 201 | * `a` (required) coordinates to a kind `31922` or `31923` calendar event being responded to. | 172 | * `a` (required) coordinates to a kind `31922` or `31923` calendar event being responded to. |
| 202 | * `e` (optional) event id of a kind `31922` or `31923` calendar event being responded to. | 173 | * `e` (optional) event id of a kind `31922` or `31923` calendar event being responded to. |
| 203 | * `d` (required) universally unique identifier. Generated by the client creating the calendar event RSVP. | 174 | * `d` (required) universally unique identifier. Generated by the client creating the calendar event RSVP. |
| @@ -205,11 +176,11 @@ The list of tags are as follows: | |||
| 205 | * `fb` (optional) `free` or `busy`. Determines if the user would be free or busy for the duration of the calendar event. This tag must be omitted or ignored if the `status` label is set to `declined`. | 176 | * `fb` (optional) `free` or `busy`. Determines if the user would be free or busy for the duration of the calendar event. This tag must be omitted or ignored if the `status` label is set to `declined`. |
| 206 | * `p` (optional) pubkey of the author of the calendar event being responded to. | 177 | * `p` (optional) pubkey of the author of the calendar event being responded to. |
| 207 | 178 | ||
| 208 | ```json | 179 | ```yaml |
| 209 | { | 180 | { |
| 210 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, | 181 | "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>, |
| 211 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, | 182 | "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, |
| 212 | "created_at": <Unix timestamp in seconds>, | 183 | "created_at": <unix timestamp in seconds>, |
| 213 | "kind": 31925, | 184 | "kind": 31925, |
| 214 | "content": "<note>", | 185 | "content": "<note>", |
| 215 | "tags": [ | 186 | "tags": [ |