nips icon indicating copy to clipboard operation
nips copied to clipboard

Add Kind 15 for Encrypted File message

Open wcat7 opened this issue 1 year ago • 0 comments

File Message Kind

{
  "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>"],
    ["decryption-nonce", "<decryption-nonce>"]
    // 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.
  • decryption-nonce: The decryption nonce 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>).

wcat7 avatar Oct 12 '24 03:10 wcat7