add file message kind

This commit is contained in:
water 2024-10-12 11:44:35 +08:00 committed by GitHub
parent e381b577c9
commit deb9a6357b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

29
17.md
View File

@ -35,6 +35,35 @@ 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**. 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": "<usual hash>",
"pubkey": "<sender-pubkey>",
"created_at": "<current-time>",
"kind": 15,
"tags": [
["p", "<receiver-1-pubkey>", "<relay-url>"],
["p", "<receiver-2-pubkey>", "<relay-url>"],
["e", "<kind-14-id>", "<relay-url>", "reply"], // if this is a reply
["subject", "<conversation-title>"],
["file-type", "<file-mime-type>"],
["encryption-algorithm", "<encryption-algorithm>"],
["decryption-key", "<decryption-key>"]
// rest of tags...
],
"content": "<file-url-or-base64-content-in-plain-text>"
}
```
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.
- `content`: Contains either the URL of the file (`<file-url>`) or the encrypted data in base64 format (`<base64-content-in-plain-text>`).
## Chat Rooms ## 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. 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.