diff --git a/81.md b/81.md index abb5255..eecca70 100644 --- a/81.md +++ b/81.md @@ -6,85 +6,68 @@ Relationship Status `draft` `optional` -Event `kind:30382` documents a "Relationship Status" between two keys, the signer and a `p`-tag, and uses private and public tags to enhance the description of that relationship. Since statuses change over time, this event is defined as a _parameterized replaceable event_ with a single `d` tag whole value identifies the key pair. +Event `kind:30382` documents a "Relationship Status" between two keys and uses private and public tags to describe that relationship. -Optional `n` tags add the target key to unbound lists. +Since statuses change over time, this event is defined as a _parameterized replaceable event_ with a single `d` tag that identifies the target key. -The private tags are JSON Stringified, [NIP-44](44.md)-encrypted and placed inside the `.content` of the event. - -Example of Public Status +When the relationship is public, the `d` tag is the same as the `p`-tag. ```js { "kind": 30382, "tags": [ - ["d", ""], - ["n", "Client List"], - ["n", "Special Holidays List"], - ["p", "", "relay"], - ["trust_level", "1"], - ["petname", ""], - ["summary", ""] - ], - "content": "", - // ...other fields -} -``` - -Example of Private Status - -```js -{ - "kind": 30382, - "tags": [ - ["d", ""], - ["n", "Clients List"], - ["n", "6064460175057025"], // see private n-tags below + ["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"], + ["n", "Follow"], + ["n", "Bitcoiners"], + ["n", "6064460175057025"] + ["p", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411", ""], ], "content": nip44Encrypt(JSON.stringify([ - ["p", "", "relay"], - ["petname", ""], - ["summary", ""], - ["nip82secret", ""] + ["petname", "NVK (Coldcard)"], + ["summary", "Owes me a beer"] ])), // ...other fields } ``` +The private tags are JSON Stringified, [NIP-44](44.md)-encrypted to the signer's keys and placed inside the `.content` of the event. + `petname` SHOULD be used instead of the person's display name in all interfaces -Profile screens MAY display the summary of the relationship and allow the user to change the tags of this event. +### Relationship Categories -Clients MAY filter by `kind:30382`, with or without `n` tags, to determine how to assemble feeds, group messages, and when to display content. +Optional `n` tags `["n", ""]` add the target key to unbound lists. This allows clients to query by `n` and download all members of a list. -Web of Trust processors MAY use `kind:30382` as directional edges in the Web of Trust graph. - -Multiple `p`-tags in a single `kind:30382` represent a group of individuals that SHOULD be considered as of one entity. The other tags decribe the relationship to the entity and not individual keys. - -Having one `p`-tag in multiple `d`-tags represent separate statuses for the same pubkey based on their participation in a list `n` - -### Private `n`-tags - -Clients MAY hide human readable `n`-tags behind a code and list their code maps in the new "Unbound List Names" event kind (`kind:10008`), using the `map` tag from code to name. +List `codes` can be human readable or not. A new event kind named "Unbound List Names" (`kind:10008`) uses `map` tags to display the list name. Clients SHOULD display the `name` instead of the `code` if the `code` is present in this list. ```js { "kind": 10008, "content": nip44Encrypt(JSON.stringify([ - ["map", "", ""], - ["map", "Clients List", "Clients List"], // public list of my Clients - ["map", "6064460175057025", "Idiots"] // private list of idiots + ["map", "", ""], + ["map", "Bitcoiners", "Bitcoiners"], + ["map", "6064460175057025", "Debtors"] ])), // ...other fields } ``` -### Deterministic `d`-Tags. +### Private Relationship Status -For private use cases that must contain deterministic d-Tags, the recommendation is to use [NIP-44](44.md)'s `hkdf` function and use a hash between the user's private key and the pubkey of the `p` tag. +For relationships that MUST remain private, a deterministic `d`-Tag is calculated using [NIP-44](44.md)'s `hkdf` function and a `sha256` hash between the signer's private key and the pubkey of the `p` tag. -``` -nip81_key = hkdf(private_key, salt: 'nip81') -bobs_d_tag = sha256(nip81_key || bobs_pub) -kates_d_tag = sha256(nip81_key || kates_pub) +```js +{ + "kind": 30382, + "tags": [ + ["d", sha256(hkdf(private_key, salt: 'nip81') || "")], + ], + "content": nip44Encrypt(JSON.stringify([ + ["p", "", "relay"], + ["n", "Clients List"], + ["petname", ""], + ["summary", ""], + ])), + // ...other fields +} ``` \ No newline at end of file