/** * attachments.ts — W4: File attachment helpers for @oxpulse/chat-sdk. * * E2EE-friendly: client encrypts the blob with the room SFrame key before * uploading; server stores ciphertext and never decrypts. * * Flow: * 1. presignAttachment — POST /api/sdk/attachments/presign * 2. PUT uploadUrl — upload the (encrypted) blob. * 3. client.send — send a sealed message referencing the attachment. * * sendFile() is a convenience wrapper that runs all three steps. */ /** Maximum attachment blob size enforced client-side before calling presign. */ export declare const MAX_ATTACHMENT_BYTES: number; export interface PresignArgs { /** MIME type of the blob (e.g. "image/png"). */ mimeType: string; /** Byte size of the (encrypted) blob. */ byteSize: number; /** SHA-256 hex digest of the plaintext (for deduplication). */ sha256: string; /** Optional ThumbHash preview, base64-encoded. */ thumbhashB64?: string; } export interface PresignResult { /** Server-assigned attachment UUID. */ attachmentId: string; /** PUT-able URL (relative, 5-min TTL). */ uploadUrl: string; } export interface SendFileArgs { /** Caller-assigned stable user identifier (passed through to send). */ senderUid: string; /** E2EE-sealed ciphertext to include in the message payload. */ sealed: ArrayBuffer; /** MIME type for the presign request. Falls back to blob.type. */ mimeType?: string; /** SHA-256 hex of the plaintext. Required for deduplication metadata. */ sha256: string; /** Optional ThumbHash preview, base64-encoded. */ thumbhashB64?: string; } /** Duck-typed interface satisfied by SDKChatClient. */ interface AttachmentClient { readonly baseUrl: string; readonly jwt: string; send(roomId: string, args: { senderUid: string; sealed: ArrayBuffer; msgId?: string; }): Promise<{ seq: number; msgId: string; }>; } /** * POST /api/sdk/attachments/presign * * Returns a signed PUT URL and attachment_id. * Throws SDKChatError on network or server error. */ export declare function presignAttachment(client: AttachmentClient, args: PresignArgs): Promise; /** * sendFile — presign → PUT → send sealed reference. * * Validates blob size client-side before touching the network. * * @param client Object satisfying AttachmentClient interface. * @param roomId Room to post the attachment message to. * @param blob The (encrypted) blob to upload. * @param args senderUid + sealed ciphertext + sha256. */ export declare function sendFile(client: AttachmentClient, roomId: string, blob: Blob, args: SendFileArgs): Promise<{ seq: number; msgId: string; }>; export {}; //# sourceMappingURL=attachments.d.ts.map