import { SyncableExcalidrawElement } from "."; import { ExcalidrawElement, FileId } from "../../packages/excalidraw/element/types"; import { AppState, BinaryFileData } from "../../packages/excalidraw/types"; import Portal from "../collab/Portal"; 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: SocketIOClient.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; }