From 13e0e5f9afdc63cf6a9df5b44ec1331f4e77bcf0 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Fri, 10 Mar 2023 11:22:59 -0600 Subject: [PATCH] Add kinds 10 and 11 to prevent race conditions when updating contact lists --- 02.md | 4 +++- README.md | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/02.md b/02.md index 8b0aee15..bb7402c2 100644 --- a/02.md +++ b/02.md @@ -6,7 +6,7 @@ Follow List `final` `optional` -A special event with kind `3`, meaning "follow list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following. +Three special events having kinds `3`, `10`, and `11` are defined as having a list of `p` tags. Kind `3` defines the complete set of pubkeys one is following at a given point in time; kind `10` adds one or more pubkeys to that list; and kind `11` removes one or more pubkeys from that list. Each tag entry should contain the key for the profile, a relay URL where events from that key can be found (can be set to an empty string if not needed), and a local name (or "petname") for that profile (can also be set to an empty string or not provided), i.e., `["p", <32-bytes hex key>,
, ]`. The `content` can be anything and should be ignored. @@ -29,6 +29,8 @@ Every new following list that gets published overwrites the past ones, so it sho Whenever new follows are added to an existing list, clients SHOULD append them to the end of the list, so they are stored in chronological order. +When building a contact list, clients should query for the latest kind `3` event, and any subsequent kind `10` and `11` events that modify the original list. Contacts SHOULD use kind `10` and `11` in order to prevent race conditions when updating contact lists from multiple clients simultaneously, unless the intention is to write a canonical, complete contact list. + ## Uses ### Follow list backup diff --git a/README.md b/README.md index 10b1dfb7..3a3eec99 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | `6` | Repost | [18](18.md) | | `7` | Reaction | [25](25.md) | | `8` | Badge Award | [58](58.md) | +| `10` | Follow Contact | [2](02.md) | +| `11` | Unfollow Contact | [2](02.md) | | `16` | Generic Repost | [18](18.md) | | `40` | Channel Creation | [28](28.md) | | `41` | Channel Metadata | [28](28.md) |