diff options
| author | fiatjaf <faitjaf@gmail.com> | 2022-05-01 07:48:57 -0300 |
|---|---|---|
| committer | fiatjaf <faitjaf@gmail.com> | 2022-05-01 07:48:57 -0300 |
| commit | f25c7e672c23ca5463fa5c0fcb5e5f424d956862 (patch) | |
| tree | 597462ec02ed56ef53f268279a31f62edd3f37eb /02.md | |
migrate nips from main nostr repo.
Diffstat (limited to '02.md')
| -rw-r--r-- | 02.md | 73 |
1 files changed, 73 insertions, 0 deletions
| @@ -0,0 +1,73 @@ | |||
| 1 | NIP-02 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Contact List and Petnames | ||
| 5 | ------------------------- | ||
| 6 | |||
| 7 | `draft` `optional` `author:fiatjaf` `author:arcbtc` | ||
| 8 | |||
| 9 | A special event with kind `3`, meaning "contact list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following. | ||
| 10 | |||
| 11 | 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 `null` or a invalid string if not needed), and a local name (or "petname") for that profile (can also be set to `null`), i.e., `["p", <32-bytes hex key>, <main relay URL>, <petname>]`. The `content` can be anything and should be ignored. | ||
| 12 | |||
| 13 | For example: | ||
| 14 | |||
| 15 | ```json | ||
| 16 | { | ||
| 17 | "kind": 3, | ||
| 18 | "tags": [ | ||
| 19 | ["p", "91cf9..4e5ca", "wss://alicerelay.com/", "alice"], | ||
| 20 | ["p", "14aeb..8dad4", "wss://bobrelay.com/nostr", "bob"], | ||
| 21 | ["p", "612ae..e610f", "ws://carolrelay.com/ws", "carol"] | ||
| 22 | ], | ||
| 23 | "content": "", | ||
| 24 | ...other fields | ||
| 25 | ``` | ||
| 26 | |||
| 27 | Every new contact list that gets published overwrites the past ones, so it should contain all entries. Relays and clients SHOULD delete past contact lists as soon as they receive a new one. | ||
| 28 | |||
| 29 | ## Uses | ||
| 30 | |||
| 31 | ### Contact list backup | ||
| 32 | |||
| 33 | If one believes a relay will store their events for sufficient time, they can use this kind-3 event to backup their following list and recover on a different device. | ||
| 34 | |||
| 35 | ### Profile discovery and context augmentation | ||
| 36 | |||
| 37 | A client may rely on the kind-3 event to display a list of followed people by profiles one is browsing; make lists of suggestions on who to follow based on the contact lists of other people one might be following or browsing; or show the data in other contexts. | ||
| 38 | |||
| 39 | ### Relay sharing | ||
| 40 | |||
| 41 | A client may publish a full list of contacts with good relays for each of their contacts so other clients may use these to update their internal relay lists if needed, increasing censorship-resistant. | ||
| 42 | |||
| 43 | ### Petname scheme | ||
| 44 | |||
| 45 | The data from these contact lists can be used by clients to construct local ["petname"](http://www.skyhunter.com/marcs/petnames/IntroPetNames.html) tables derived from other people's contact lists. This alleviates the need for global human-readable names. For example: | ||
| 46 | |||
| 47 | A user has an internal contact list that says | ||
| 48 | |||
| 49 | ```json | ||
| 50 | [ | ||
| 51 | ["p", "21df6d143fb96c2ec9d63726bf9edc71", null, "erin"] | ||
| 52 | ] | ||
| 53 | ``` | ||
| 54 | |||
| 55 | And receives two contact lists, one from `21df6d143fb96c2ec9d63726bf9edc71` that says | ||
| 56 | |||
| 57 | ```json | ||
| 58 | [ | ||
| 59 | ["p", "a8bb3d884d5d90b413d9891fe4c4e46d", null, "david"] | ||
| 60 | ] | ||
| 61 | ``` | ||
| 62 | |||
| 63 | and another from `a8bb3d884d5d90b413d9891fe4c4e46d` that says | ||
| 64 | |||
| 65 | ```json | ||
| 66 | [ | ||
| 67 | ["p", "f57f54057d2a7af0efecc8b0b66f5708", null, "frank"] | ||
| 68 | ] | ||
| 69 | ``` | ||
| 70 | |||
| 71 | When the user sees `21df6d143fb96c2ec9d63726bf9edc71` the client can show _erin_ instead; | ||
| 72 | When the user sees `a8bb3d884d5d90b413d9891fe4c4e46d` the client can show _david.erin_ instead; | ||
| 73 | When the user sees `f57f54057d2a7af0efecc8b0b66f5708` the client can show _frank.david.erin_ instead. | ||