mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-13 02:46:24 +00:00
Creating two event kinds.
This commit is contained in:
parent
61898c0cd0
commit
4482a41d90
20
81.md
20
81.md
@ -6,21 +6,22 @@ Relationship Status
|
|||||||
|
|
||||||
`draft` `optional`
|
`draft` `optional`
|
||||||
|
|
||||||
Event `kind:30382` documents a "Relationship Status" between two keys and uses private and public tags to describe that relationship.
|
This NIP defines two new event kinds (`30382` and `30383`) to document the relationship between two keys.
|
||||||
|
|
||||||
Since statuses change over time, this event is defined as a _parameterized replaceable event_ with a single `d` tag that identifies the target key.
|
Both kinds offer public and private tags to describe that relationship. Private tags are JSON Stringified, [NIP-44](44.md)-encrypted to the signer's keys and placed inside the `.content` of the event.
|
||||||
|
|
||||||
When the relationship is public, the `d` tag is the same as the `p`-tag.
|
### Public Relationship Status
|
||||||
|
|
||||||
|
Event kind `30382` is used when the relationship itself is public, with the `d` tag receiving the public key each target key.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"kind": 30382,
|
"kind": 30382,
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
|
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
|
||||||
["n", "Follow"],
|
["n", "Follows"],
|
||||||
["n", "Bitcoiners"],
|
["n", "Bitcoiners"],
|
||||||
["n", "6064460175057025"]
|
["n", "6064460175057025"]
|
||||||
["p", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411", "<relay>"],
|
|
||||||
],
|
],
|
||||||
"content": nip44Encrypt(JSON.stringify([
|
"content": nip44Encrypt(JSON.stringify([
|
||||||
["petname", "NVK (Coldcard)"],
|
["petname", "NVK (Coldcard)"],
|
||||||
@ -30,9 +31,7 @@ When the relationship is public, the `d` tag is the same as the `p`-tag.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
`petname` SHOULD be used instead of the person's display name in all interfaces
|
|
||||||
|
|
||||||
### Relationship Categories
|
### Relationship Categories
|
||||||
|
|
||||||
@ -54,13 +53,14 @@ List `codes` can be human readable or not. A new event kind named "Unbound List
|
|||||||
|
|
||||||
### Private Relationship Status
|
### Private Relationship Status
|
||||||
|
|
||||||
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.
|
For relationships that MUST remain private, Event kind `30383` uses a similar structure but with a hashed `d` tag using [NIP-44](44.md)'s `hkdf` function.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"kind": 30382,
|
"kind": 30383,
|
||||||
"tags": [
|
"tags": [
|
||||||
["d", sha256(hkdf(private_key, salt: 'nip81') || "<pubkey>")],
|
["d", sha256(hkdf(private_key, salt: 'nip81') || "<pubkey>")],
|
||||||
|
["n", "6064460175057025"],
|
||||||
],
|
],
|
||||||
"content": nip44Encrypt(JSON.stringify([
|
"content": nip44Encrypt(JSON.stringify([
|
||||||
["p", "<pubkey>", "relay"],
|
["p", "<pubkey>", "relay"],
|
||||||
|
Loading…
Reference in New Issue
Block a user