Marmot-TS
    Preparing search index...

    Type Alias MediaAttachment

    MediaAttachment: Omit<FileMetadata, "sha256" | "type"> & Required<
        Pick<FileMetadata, "sha256" | "type">,
    > & { filename: string; nonce: string; version: typeof MIP04_VERSION }

    MIP-04 media attachment — a FileMetadata extended with the extra fields required by the MIP-04 v2 encryption scheme.

    Use createImetaTagForAttachment from applesauce to serialize this into an imeta tag for a group message, and getFileMetadataFromImetaTag to parse it back. The n and v fields are passed through via the imeta name-value pair format defined in NIP-92.

    Type Declaration

    • filename: string

      Original filename (e.g. "photo.jpg"). Used in key derivation and AEAD associated data — must match exactly.

    • nonce: string

      Hex-encoded 12-byte encryption nonce (24 hex characters). Stored in the n field of the imeta tag. Generated randomly by encryptMediaFile and required for decryption.

    • version: typeof MIP04_VERSION

      MIP-04 encryption version. Always "mip04-v2" for new attachments. Stored in the v field of the imeta tag.