Add optional fields & clarify that kind 15 should be sealed and then gift-wrapped

This commit is contained in:
water 2024-12-20 11:08:14 +08:00
parent c00e2b7550
commit 022daabd60

11
17.md
View File

@ -52,6 +52,7 @@ Kind `14`s MUST never be signed. If it is signed, the message might leak to rela
["encryption-algorithm", "<encryption-algorithm>"],
["decryption-key", "<decryption-key>"],
["decryptiion-nonce", "<decryption-nonce>"],
["x", "<the SHA-256 hexencoded string of the file>"],
// rest of tags...
],
"content": "<file-url>"
@ -65,6 +66,14 @@ Kind 15 is used for sending encrypted file event messages:
- `decryption-key`: The decryption key that will be used by the recipient to decrypt the file.
- `decryption-nonce`: The decryption nonce that will be used by the recipient to decrypt the file.
- `content`: The URL of the file (`<file-url>`).
- `x` containing the SHA-256 hexencoded string of the file.
- `size` (optional) size of file in bytes
- `dim` (optional) size of file in pixels in the form `<width>x<height>`
- `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client
- `thumb` (optional) url of thumbnail with same aspect ratio
- `fallback` (optional) zero or more fallback file sources in case `url` fails
Just like kind 14, kind `15`s MUST never be signed.
## Chat Rooms
@ -76,7 +85,7 @@ An optional `subject` tag defines the current name/topic of the conversation. An
## Encrypting
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.
Following [NIP-59](59.md), the **unsigned** `kind:14` & `kind:15` chat message must be sealed (`kind:13`) and then gift-wrapped (`kind:1059`) to each receiver and the sender individually.
```js
{