diff options
Diffstat (limited to '17.md')
| -rw-r--r-- | 17.md | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -12,18 +12,18 @@ This NIP defines an encrypted direct messaging scheme using [NIP-44](44.md) encr | |||
| 12 | 12 | ||
| 13 | Kind `14` is a chat message. `p` tags identify one or more receivers of the message. | 13 | Kind `14` is a chat message. `p` tags identify one or more receivers of the message. |
| 14 | 14 | ||
| 15 | ```js | 15 | ```jsonc |
| 16 | { | 16 | { |
| 17 | "id": "<usual hash>", | 17 | "id": "<usual hash>", |
| 18 | "pubkey": "<sender-pubkey>", | 18 | "pubkey": "<sender-pubkey>", |
| 19 | "created_at": now(), | 19 | "created_at": "<current-time>", |
| 20 | "kind": 14, | 20 | "kind": 14, |
| 21 | "tags": [ | 21 | "tags": [ |
| 22 | ["p", "<receiver-1-pubkey>", "<relay-url>"], | 22 | ["p", "<receiver-1-pubkey>", "<relay-url>"], |
| 23 | ["p", "<receiver-2-pubkey>", "<relay-url>"], | 23 | ["p", "<receiver-2-pubkey>", "<relay-url>"], |
| 24 | ["e", "<kind-14-id>", "<relay-url>", "reply"] // if this is a reply | 24 | ["e", "<kind-14-id>", "<relay-url>", "reply"] // if this is a reply |
| 25 | ["subject", "<conversation-title>"], | 25 | ["subject", "<conversation-title>"], |
| 26 | ... | 26 | // rest of tags... |
| 27 | ], | 27 | ], |
| 28 | "content": "<message-in-plain-text>", | 28 | "content": "<message-in-plain-text>", |
| 29 | } | 29 | } |
| @@ -47,7 +47,7 @@ An optional `subject` tag defines the current name/topic of the conversation. An | |||
| 47 | 47 | ||
| 48 | Following [NIP-59](59.md), the **unsigned** `kind:14` chat message must be sealed (`kind:13`) and then gift-wrapped (`kind:1059`) to each receiver and the sender individually. | 48 | Following [NIP-59](59.md), the **unsigned** `kind:14` chat message must be sealed (`kind:13`) and then gift-wrapped (`kind:1059`) to each receiver and the sender individually. |
| 49 | 49 | ||
| 50 | ```js | 50 | ```jsonc |
| 51 | { | 51 | { |
| 52 | "id": "<usual hash>", | 52 | "id": "<usual hash>", |
| 53 | "pubkey": randomPublicKey, | 53 | "pubkey": randomPublicKey, |
| @@ -86,7 +86,7 @@ Clients CAN offer disappearing messages by setting an `expiration` tag in the gi | |||
| 86 | 86 | ||
| 87 | Kind `10050` indicates the user's preferred relays to receive DMs. The event MUST include a list of `relay` tags with relay URIs. | 87 | Kind `10050` indicates the user's preferred relays to receive DMs. The event MUST include a list of `relay` tags with relay URIs. |
| 88 | 88 | ||
| 89 | ```js | 89 | ```jsonc |
| 90 | { | 90 | { |
| 91 | "kind": 10050, | 91 | "kind": 10050, |
| 92 | "tags": [ | 92 | "tags": [ |
| @@ -94,7 +94,7 @@ Kind `10050` indicates the user's preferred relays to receive DMs. The event MUS | |||
| 94 | ["relay", "wss://myrelay.nostr1.com"], | 94 | ["relay", "wss://myrelay.nostr1.com"], |
| 95 | ], | 95 | ], |
| 96 | "content": "", | 96 | "content": "", |
| 97 | //...other fields | 97 | // other fields... |
| 98 | } | 98 | } |
| 99 | ``` | 99 | ``` |
| 100 | 100 | ||
| @@ -102,7 +102,7 @@ Clients SHOULD publish kind `14` events to the `10050`-listed relays. If that is | |||
| 102 | 102 | ||
| 103 | ## Relays | 103 | ## Relays |
| 104 | 104 | ||
| 105 | It's advisable that relays do not serve `kind:14` to clients other than the ones tagged in them. | 105 | It's advisable that relays do not serve `kind:1059` to clients other than the ones tagged in them. |
| 106 | 106 | ||
| 107 | It's advisable that users choose relays that conform to these practices. | 107 | It's advisable that users choose relays that conform to these practices. |
| 108 | 108 | ||
| @@ -133,7 +133,7 @@ When sending a message to anyone, clients must then connect to the relays in the | |||
| 133 | 133 | ||
| 134 | This example sends the message `Hola, que tal?` from `nsec1w8udu59ydjvedgs3yv5qccshcj8k05fh3l60k9x57asjrqdpa00qkmr89m` to `nsec12ywtkplvyq5t6twdqwwygavp5lm4fhuang89c943nf2z92eez43szvn4dt`. | 134 | This example sends the message `Hola, que tal?` from `nsec1w8udu59ydjvedgs3yv5qccshcj8k05fh3l60k9x57asjrqdpa00qkmr89m` to `nsec12ywtkplvyq5t6twdqwwygavp5lm4fhuang89c943nf2z92eez43szvn4dt`. |
| 135 | 135 | ||
| 136 | The two final GiftWraps, one to the receiver and the other to the sender, are: | 136 | The two final GiftWraps, one to the receiver and the other to the sender, respectively, are: |
| 137 | 137 | ||
| 138 | ```json | 138 | ```json |
| 139 | { | 139 | { |