mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 08:25:53 -05:00
Fleshed out further
This commit is contained in:
parent
f5a22ce6e6
commit
1d1d76d13b
67
0A.md
67
0A.md
|
@ -1,25 +1,51 @@
|
||||||
NIP-0A
|
NIP-0A
|
||||||
======
|
======
|
||||||
|
|
||||||
Contact List v2
|
Follow List v2
|
||||||
---------------
|
--------------
|
||||||
|
|
||||||
This is an early draft, I'm still working out the details.
|
An event with kind `103` means "follow list" which communicates the set of profiles
|
||||||
|
(represented by public keys) that the author is currently following.
|
||||||
|
|
||||||
## Events and Tags
|
The public keys followed are specified in "p" tags.
|
||||||
|
|
||||||
Events have tags like this for each contact:
|
Additional "np" tags are present only to help with synchronization as described below.
|
||||||
|
|
||||||
|
The `.content` is not used.
|
||||||
|
|
||||||
|
## Tags
|
||||||
|
|
||||||
|
Each profile followed is reprsented in a "p" tag as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
["p", <pubkey1>, <relay>, <petname>, <timestamp1>]
|
["p", <pubkey>, <relay>, <petname>, <timestamp>]
|
||||||
["np", <pubkey2>, <relay>, <petname>, <timestamp2>]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`p` means the person is counted as a contact. `np` means they are not counted as a contact, but
|
Where
|
||||||
we are just remembering when they were removed. Note that `np` is not searchable on relays.
|
|
||||||
|
|
||||||
All contacts in the stated range should be listed. These events are complete lists, they are
|
* `pubkey` is the hex encoded public key of the profile
|
||||||
not change sets.
|
* `relay` is an optional relay where the `pubkey` is known to post, or an empty string
|
||||||
|
* `petname` is an optional petname that the author uses for the contact, or an empty string
|
||||||
|
* `timestamp` is the time when the entry was added
|
||||||
|
|
||||||
|
## Removal of entries
|
||||||
|
|
||||||
|
Entries are not removed. Instead they are converted into "np" entries and their
|
||||||
|
timestamp is updated to time they are considered removed.
|
||||||
|
|
||||||
|
```
|
||||||
|
["np", <pubkey>, <relay>, <petname>, <timestamp2>]
|
||||||
|
```
|
||||||
|
|
||||||
|
Pubkeys MUST only be listed once in either a "p" tag or an "np" tag.
|
||||||
|
|
||||||
|
`p` means the person is counted as a contact. `np` means they are not counted as a contact
|
||||||
|
but the entry serves to help remember when they were removed so that conflicts can be
|
||||||
|
resolved.
|
||||||
|
|
||||||
|
Note that `np` is not searchable on relays.
|
||||||
|
|
||||||
|
All contacts should be listed. These events are complete lists, they are not change sets.
|
||||||
|
|
||||||
## Owner Handling
|
## Owner Handling
|
||||||
|
|
||||||
|
@ -30,11 +56,13 @@ When you remove a person, you find their entry and make sure the tag is "np" and
|
||||||
you update the timestamp to the current time. If missing, you create the entry.
|
you update the timestamp to the current time. If missing, you create the entry.
|
||||||
|
|
||||||
When you receive your own contact list (presumably created by a different client), you merge it
|
When you receive your own contact list (presumably created by a different client), you merge it
|
||||||
with your local one and publish the result. See [Merge Operation](#merge-operation) below.
|
with your local one and if the data has changed you publish the result. See
|
||||||
|
[Merge Operation](#merge-operation) below.
|
||||||
|
|
||||||
## Observers
|
## Observers
|
||||||
|
|
||||||
A client that does not store any data can simply accept the latest contact list.
|
A client that does not store any data can simply accept the latest contact list as probably
|
||||||
|
up to date.
|
||||||
|
|
||||||
Clients that do store data can instead choose to merge newer contact lists with the data they
|
Clients that do store data can instead choose to merge newer contact lists with the data they
|
||||||
already hold for the person's contacts that was created from previous events. The benefit of
|
already hold for the person's contacts that was created from previous events. The benefit of
|
||||||
|
@ -46,19 +74,6 @@ The merge operation is as follows: On a tag-by-tag basis, if only one event has
|
||||||
you accept that line. If both events have a line for that pubkey, you take the line with the largest
|
you accept that line. If both events have a line for that pubkey, you take the line with the largest
|
||||||
timestamp.
|
timestamp.
|
||||||
|
|
||||||
## Possible Splitting (TBD)
|
|
||||||
|
|
||||||
There are four kinds (to be assigned):
|
|
||||||
|
|
||||||
kind1 - all contacts whose public keys end with '0' - '3'
|
|
||||||
kind2 - all contacts whose public keys end with '4' - '7'
|
|
||||||
kind3 - all contacts whose public keys end with '8' - 'b'
|
|
||||||
kind4 - all contacts whose public keys end with 'c' - 'f'
|
|
||||||
|
|
||||||
NOTE: We could actually continue to use kind3, as the 'timestamp' is additional and would
|
|
||||||
be ignored by current software, as would the 'np' tags. However that wouldn't allow splitting the
|
|
||||||
list into four chunks.
|
|
||||||
|
|
||||||
## Rationale
|
## Rationale
|
||||||
|
|
||||||
This is functionally implements a Last-Write-Wins Element Set, which is a conflict-free replicated
|
This is functionally implements a Last-Write-Wins Element Set, which is a conflict-free replicated
|
||||||
|
|
Loading…
Reference in New Issue
Block a user