import type { SyncableExcalidrawElement } from "."; import type { ExcalidrawElement, FileId, } from "../../packages/excalidraw/element/types"; import type { AppState, BinaryFileData } from "../../packages/excalidraw/types"; import type Portal from "../collab/Portal"; import type { Socket } from "socket.io-client"; export interface StorageBackend { isSaved: (portal: Portal, elements: readonly ExcalidrawElement[]) => boolean; saveToStorageBackend: ( portal: Portal, elements: readonly SyncableExcalidrawElement[], appState: AppState, ) => Promise; loadFromStorageBackend: ( roomId: string, roomKey: string, socket: Socket | null, ) => Promise; saveFilesToStorageBackend: ({ prefix, files, }: { prefix: string; files: { id: FileId; buffer: Uint8Array; }[]; }) => Promise<{ savedFiles: Map; erroredFiles: Map; }>; loadFilesFromStorageBackend: ( prefix: string, decryptionKey: string, filesIds: readonly FileId[], ) => Promise<{ loadedFiles: BinaryFileData[]; erroredFiles: Map; }>; } export interface StoredScene { sceneVersion: number; iv: Uint8Array; ciphertext: ArrayBuffer; }