diff --git a/17.md b/17.md index f091a96..1bc258d 100644 --- a/17.md +++ b/17.md @@ -35,6 +35,46 @@ Tags that mention, quote and assemble threading structures MUST follow [NIP-10]( Kind `14`s MUST never be signed. If it is signed, the message might leak to relays and become **fully public**. +## File Message Kind + +```jsonc +{ + "id": "", + "pubkey": "", + "created_at": "", + "kind": 15, + "tags": [ + ["p", "", ""], + ["p", "", ""], + ["e", "", "", "reply"], // if this is a reply + ["subject", ""], + ["file-type", ""], + ["encryption-algorithm", ""], + ["decryption-key", ""], + ["decryptiion-nonce", ""], + ["x", ""], + // rest of tags... + ], + "content": "" +} +``` + +Kind 15 is used for sending encrypted file event messages: + +- `file-type`: Specifies the MIME type of the attached file (e.g., `image/jpeg`, `audio/mpeg`, etc.). +- `encryption-algorithm`: Indicates the encryption algorithm used for encrypting the file. Supported algorithms may include `aes-gcm`, `chacha20-poly1305`,`aes-cbc` etc. +- `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 (``). +- `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 `x` +- `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 The set of `pubkey` + `p` tags defines a chat room. If a new `p` tag is added or a current one is removed, a new room is created with clean message history. @@ -45,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. ```jsonc {