π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Swap
Manav Rathi7954b143b531
diff --git a/web/apps/cast/src/services/render.ts b/web/apps/cast/src/services/render.tsindex f651c6901b..4cb5b7d11c 100644--- a/web/apps/cast/src/services/render.ts+++ b/web/apps/cast/src/services/render.ts@@ -7,7 +7,7 @@ import {decryptRemoteFile,FileDiffResponse,RemoteEnteFile,- type EnteFile2,+ type EnteFile,} from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";@@ -175,7 +175,7 @@ export const getRemoteCastCollectionFiles = async (return files;};-const isFileEligible = (file: EnteFile2) => {+const isFileEligible = (file: EnteFile) => {if (!isImageOrLivePhoto(file)) return false;if ((file.info?.fileSize ?? 0) > 100 * 1024 * 1024) return false;@@ -193,7 +193,7 @@ const isFileEligible = (file: EnteFile2) => {return true;};-const isImageOrLivePhoto = (file: EnteFile2) =>+const isImageOrLivePhoto = (file: EnteFile) =>file.metadata.fileType == FileType.image ||file.metadata.fileType == FileType.livePhoto;@@ -204,12 +204,12 @@ const isImageOrLivePhoto = (file: EnteFile2) =>* Once we're done showing the file, the URL should be revoked using* {@link URL.revokeObjectURL} to free up browser resources.*/-const createRenderableURL = async (castToken: string, file: EnteFile2) => {+const createRenderableURL = async (castToken: string, file: EnteFile) => {const imageBlob = await renderableImageBlob(castToken, file);return URL.createObjectURL(imageBlob);};-const renderableImageBlob = async (castToken: string, file: EnteFile2) => {+const renderableImageBlob = async (castToken: string, file: EnteFile) => {const shouldUseThumbnail = isChromecast();let blob = await downloadFile(castToken, file, shouldUseThumbnail);@@ -239,7 +239,7 @@ const renderableImageBlob = async (castToken: string, file: EnteFile2) => {const downloadFile = async (castToken: string,- file: EnteFile2,+ file: EnteFile,shouldUseThumbnail: boolean,) => {if (!isImageOrLivePhoto(file))diff --git a/web/apps/photos/src/services/publicCollectionService.ts b/web/apps/photos/src/services/publicCollectionService.tsindex 2764c994b6..870c1c887b 100644--- a/web/apps/photos/src/services/publicCollectionService.ts+++ b/web/apps/photos/src/services/publicCollectionService.ts@@ -6,11 +6,11 @@ import type {CollectionPublicMagicMetadataData,} from "ente-media/collection";import type {- EncryptedEnteFile,EnteFile,MagicMetadataCore,+ RemoteEnteFile,} from "ente-media/file";-import { decryptFile, mergeMetadata } from "ente-media/file";+import { decryptRemoteFile, mergeMetadata } from "ente-media/file";import { savedPublicCollections } from "ente-new/albums/services/public-albums-fdb";import { sortFiles } from "ente-new/photos/services/files";import { CustomError, parseSharingErrorCodes } from "ente-shared/error";@@ -220,7 +220,8 @@ export const syncPublicFiles = async (files = [];// eslint-disable-next-line @typescript-eslint/no-unused-varsfor (const [_, file] of latestVersionFiles) {- if (file.isDeleted) {+ // TODO(RE):+ if ("isDeleted" in file && file.isDeleted) {continue;}files.push(file);@@ -275,9 +276,12 @@ const getPublicFiles = async (decryptedFiles = [...decryptedFiles,...(await Promise.all(- resp.data.diff.map(async (file: EncryptedEnteFile) => {+ resp.data.diff.map(async (file: RemoteEnteFile) => {if (!file.isDeleted) {- return await decryptFile(file, collection.key);+ return await decryptRemoteFile(+ file,+ collection.key,+ );} else {return file;}@@ -292,7 +296,9 @@ const getPublicFiles = async (sortFiles(mergeMetadata([...(files || []), ...decryptedFiles].filter(- (item) => !item.isDeleted,+ // TODO(RE):+ // (item) => !item.isDeleted,+ (file) => !("isDeleted" in file && file.isDeleted),),),sortAsc,diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.tsindex 23a650c9be..2a0173f194 100644--- a/web/apps/photos/src/services/upload-manager.ts+++ b/web/apps/photos/src/services/upload-manager.ts@@ -30,9 +30,9 @@ import UploadService, {import { processVideoNewUpload } from "ente-gallery/services/video";import type { Collection } from "ente-media/collection";import {- decryptFile,- type EncryptedEnteFile,+ decryptRemoteFile,type EnteFile,+ type RemoteEnteFile,} from "ente-media/file";import type { ParsedMetadata } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";@@ -544,7 +544,7 @@ class UploadManager {private async postUploadTask(uploadableItem: UploadableUploadItem,uploadResult: UploadResult,- uploadedFile: EncryptedEnteFile | EnteFile | undefined,+ uploadedFile: RemoteEnteFile | EnteFile | undefined,): Promise<FinishedUploadResult> {log.info(`Upload ${uploadableItem.fileName} | ${uploadResult}`);const finishedUploadResult =@@ -565,8 +565,8 @@ class UploadManager {break;case "uploaded":case "uploadedWithStaticThumbnail":- decryptedFile = await decryptFile(- uploadedFile as EncryptedEnteFile,+ decryptedFile = await decryptRemoteFile(+ uploadedFile as RemoteEnteFile,uploadableItem.collection.key,);break;@@ -598,11 +598,17 @@ class UploadManager {}this.updateExistingFiles(decryptedFile);}- await this.watchFolderCallback(- uploadResult,- uploadableItem,- uploadedFile as EncryptedEnteFile,- );++ if (isDesktop) {+ if (watcher.isUploadRunning()) {+ await watcher.onFileUpload(+ uploadResult,+ uploadableItem,+ uploadedFile,+ );+ }+ }+return finishedUploadResult;} catch (e) {log.error("Post file upload action failed", e);@@ -610,22 +616,6 @@ class UploadManager {}}- private async watchFolderCallback(- fileUploadResult: UploadResult,- fileWithCollection: ClusteredUploadItem,- uploadedFile: EncryptedEnteFile,- ) {- if (isDesktop) {- if (watcher.isUploadRunning()) {- await watcher.onFileUpload(- fileUploadResult,- fileWithCollection,- uploadedFile,- );- }- }- }-public cancelRunningUpload() {log.info("User cancelled upload");this.uiService.setUploadPhase("cancelling");diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.tsindex 904e35e236..cde7a69fad 100644--- a/web/apps/photos/src/services/watch.ts+++ b/web/apps/photos/src/services/watch.ts@@ -14,7 +14,6 @@ import type {} from "ente-base/types/ipc";import { type UploadResult } from "ente-gallery/services/upload";import type { UploadAsset } from "ente-gallery/services/upload/upload-service";-import { EncryptedEnteFile } from "ente-media/file";import {getLocalFiles,groupFilesByCollectionID,@@ -23,6 +22,11 @@ import { ensureString } from "ente-utils/ensure";import { removeFromCollection } from "./collectionService";import { type UploadItemWithCollection, uploadManager } from "./upload-manager";+interface FolderWatchUploadedFile {+ id: number;+ collectionID: number;+}+/*** Watch for file system folders and automatically update the corresponding Ente* collections.@@ -46,10 +50,10 @@ class FolderWatcher {/** `true` if we are temporarily paused to let a user upload go through. */private isPaused = false;/**- * A map from file paths to an Ente file for files that were uploaded (or- * symlinked) as part of the most recent upload attempt.+ * A map from file paths to the (fileID, collectionID) of the file that was+ * uploaded (or symlinked) as part of the most recent upload attempt.*/- private uploadedFileForPath = new Map<string, EncryptedEnteFile>();+ private uploadedFileForPath = new Map<string, FolderWatchUploadedFile>();/*** A set of file paths that could not be uploaded in the most recent upload* attempt. These are the uploads that failed due to a permanent error that@@ -324,7 +328,7 @@ class FolderWatcher {async onFileUpload(fileUploadResult: UploadResult,item: UploadItemWithCollection,- file: EncryptedEnteFile,+ file: FolderWatchUploadedFile,) {// Re the usage of ensureString: For desktop watch, the only possibility// for a UploadItem is for it to be a string (the absolute path to a@@ -404,7 +408,7 @@ class FolderWatcher {const syncedFiles: FolderWatch["syncedFiles"] = [];const ignoredFiles: FolderWatch["ignoredFiles"] = [];- const markSynced = (file: EncryptedEnteFile, path: string) => {+ const markSynced = (file: FolderWatchUploadedFile, path: string) => {syncedFiles.push({path,uploadedFileID: file.id,diff --git a/web/packages/gallery/services/upload/remote.ts b/web/packages/gallery/services/upload/remote.tsindex e0c3fc6b04..165e5cb77d 100644--- a/web/packages/gallery/services/upload/remote.ts+++ b/web/packages/gallery/services/upload/remote.ts@@ -8,8 +8,8 @@ import {} from "ente-base/http";import { apiURL, uploaderOrigin } from "ente-base/origins";import {- type EncryptedEnteFile,type EncryptedMagicMetadata,+ type RemoteEnteFile,type RemoteFileMetadata,} from "ente-media/file";import { nullToUndefined } from "ente-utils/transform";@@ -476,7 +476,7 @@ export interface UploadedFileObjectAttributes {*/export const postEnteFile = async (postFileRequest: PostEnteFileRequest,-): Promise<EncryptedEnteFile> => {+): Promise<RemoteEnteFile> => {const res = await fetch(await apiURL("/files"), {method: "POST",headers: await authenticatedRequestHeaders(),@@ -484,7 +484,7 @@ export const postEnteFile = async (});ensureOk(res);// TODO(RE):- return (await res.json()) as EncryptedEnteFile;+ return (await res.json()) as RemoteEnteFile;};/**@@ -494,7 +494,7 @@ export const postPublicAlbumsEnteFile = async (postFileRequest: PostEnteFileRequest,credentials: PublicAlbumsCredentials,-): Promise<EncryptedEnteFile> => {+): Promise<RemoteEnteFile> => {const res = await fetch(await apiURL("/public-collection/file"), {method: "POST",headers: authenticatedPublicAlbumsRequestHeaders(credentials),@@ -502,5 +502,5 @@ export const postPublicAlbumsEnteFile = async (});ensureOk(res);// TODO(RE):- return (await res.json()) as EncryptedEnteFile;+ return (await res.json()) as RemoteEnteFile;};diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.tsindex b6c89e9a58..5fb597d787 100644--- a/web/packages/gallery/services/upload/upload-service.ts+++ b/web/packages/gallery/services/upload/upload-service.ts@@ -29,10 +29,10 @@ import {} from "ente-gallery/utils/detect-type";import { readStream } from "ente-gallery/utils/native-stream";import type {- EncryptedEnteFile,EncryptedMagicMetadata,EnteFile,FilePublicMagicMetadata,+ RemoteEnteFile,} from "ente-media/file";import {fileFileName,@@ -641,7 +641,7 @@ interface UploadContext {interface UploadResponse {uploadResult: UploadResult;- uploadedFile?: EncryptedEnteFile | EnteFile;+ uploadedFile?: RemoteEnteFile | EnteFile;}/**diff --git a/web/packages/media/file-metadata.ts b/web/packages/media/file-metadata.tsindex 89c3ef7491..fe63a7a6e5 100644--- a/web/packages/media/file-metadata.ts+++ b/web/packages/media/file-metadata.ts@@ -1,5 +1,5 @@import { type Location } from "ente-base/types";-import { type EnteFile, type EnteFile2 } from "ente-media/file";+import { type EnteFile } from "ente-media/file";import { nullToUndefined } from "ente-utils/transform";import { z } from "zod/v4";import { FileType } from "./file-type";@@ -456,7 +456,7 @@ export const isArchivedFile = (file: EnteFile) =>* @returns The provided {@link EnteFile}'s filename, including the extension.* e.g. "flower.png".*/-export const fileFileName = (file: EnteFile | EnteFile2) =>+export const fileFileName = (file: EnteFile) =>file.pubMagicMetadata?.data.editedName ?? file.metadata.title;/**diff --git a/web/packages/media/file.ts b/web/packages/media/file.tsindex 60335edd63..cf75fdbdfe 100644--- a/web/packages/media/file.ts+++ b/web/packages/media/file.ts@@ -1,8 +1,4 @@-import {- decryptBox,- decryptMetadataJSON,- sharedCryptoWorker,-} from "ente-base/crypto";+import { decryptBox, decryptMetadataJSON } from "ente-base/crypto";import log from "ente-base/log";import { nullishToBlank, nullToUndefined } from "ente-utils/transform";import { z } from "zod/v4";@@ -80,7 +76,7 @@ import {* When a file is permanently deleted, remote will scrub off data from its* fields. See: [Note: Optionality of remote file fields].*/-export interface EnteFile2 {+export interface EnteFile {/*** The file's globally unique ID.*@@ -181,138 +177,6 @@ export interface EnteFile2 {pubMagicMetadata?: MagicMetadata<FilePublicMagicMetadataData>;}-export interface EncryptedEnteFile {- /**- * The file's globally unique ID.- *- * The file's ID is a integer assigned by remote as the identifier for an- * {@link EnteFile} when it is created. It is globally unique across all- * files stored by an Ente instance, and is not scoped to the current user.- */- id: number;- /**- * The ID of the collection with which this file as associated.- *- * The same file (ID) may be associated with multiple collectionID, each of- * which will come and stay as distinct {@link EnteFile} instances - all of- * which will have the same {@link id} but distinct {@link collectionID}.- *- * So the ({@link id}, {@link collectionID}) pair is a primary key, not the- * {@link id} on its own. See: [Note: Collection file].- */- collectionID: number;- /**- * The ID of the Ente user who owns the file.- *- * Files uploaded by non users on public links belong to the owner of the- * collection who created the public link (See {@link uploaderName} in- * {@link FilePublicMagicMetadataData}).- */- ownerID: number;- /**- * Information pertaining to the encrypted S3 object that has the file's- * contents.- */- file: FileObjectAttributes;- /**- * Information pertaining to the encrypted S3 object that has the contents- * of the file's thumbnail.- */- thumbnail: FileObjectAttributes;- /**- * Static, remote visible, information associated with a file.- *- * This is information about storage used by the file and its thumbnail.- * Unlike {@link metadata} which is E2EE, the {@link FileInfo} is remote- * visible for bookkeeping purposes.- *- * Files uploaded by very old versions of Ente might not have this field.- */- info?: FileInfo;- metadata: RemoteFileMetadata;- magicMetadata: EncryptedMagicMetadata;- pubMagicMetadata: EncryptedMagicMetadata;- /**- * The file's encryption key (as a base64 string), encrypted by the key of- * the collection to which it belongs.- *- * (note: This is always present. retaining this note until we remove- * nullability uncertainty from the types).- */- encryptedKey: string;- /**- * The nonce (as a base64 string) that was used when encrypting the file's- * encryption key.- *- * (note: This is always present. retaining this note until we remove- * nullability uncertainty from the types).- */- keyDecryptionNonce: string;- isDeleted: boolean;- /**- * The last time the file was updated (epoch microseconds).- *- * (e.g. magic metadata updates).- */- updationTime: number;-}--export interface EnteFile- extends Omit<- EncryptedEnteFile,- | "metadata"- | "pubMagicMetadata"- | "magicMetadata"- | "encryptedKey"- | "keyDecryptionNonce"- > {- /**- * The file's key.- *- * This is the base64 representation of the decrypted encryption key- * associated with this file. When we get the file from remote (as a- * {@link RemoteEnteFile}), the file key itself would have been encrypted by- * the key of the {@link Collection} to which this file belongs.- *- * This key is used to encrypt both the file's contents, and any associated- * data (e.g., metadatum, thumbnail) for the file.- */- key: string;- /**- * Public static metadata associated with a file.- *- * This is the immutable metadata that gets associated with a file when it- * is uploaded, and there after cannot be changed.- *- * It is visible to all users with whom the file gets shared.- *- * > {@link pubMagicMetadata} contains fields that override fields present- * > in the metadata. Clients overlay those atop the metadata fields, and- * > thus they can be used to implement edits.- *- * See: [Note: Metadatum].- */- metadata: FileMetadata;- /**- * Private mutable metadata associated with the file that is only visible to- * the owner of the file.- *- * See: [Note: Metadatum]- */- magicMetadata?: FileMagicMetadata;- /**- * Public mutable metadata associated with the file that is visible to all- * users with whom the file has been shared.- *- * While in almost all cases, files will have associated public magic- * metadata since newer clients have something or the other they need to add- * to it, its presence is not guaranteed.- *- * See: [Note: Metadatum]- */- pubMagicMetadata?: MagicMetadataCore<FilePublicMagicMetadataData>;-}-/*** Attributes about an object related to an {@link EnteFile}.*@@ -414,7 +278,6 @@ export type RemoteFileMetadata = z.infer<typeof RemoteFileMetadata>;** See: [Note: Use looseObject when parsing JSON that will get persisted]*/-// TODO(RE): Use meexport const RemoteEnteFile = z.looseObject({id: z.number(),collectionID: z.number(),@@ -445,7 +308,6 @@ export const RemoteEnteFile = z.looseObject({* - They may have been removed from the collection.** - They have been deleted (either moved to trash, or permanently deleted).- **/isDeleted: z.boolean().nullish().transform(nullToUndefined),metadata: RemoteFileMetadata,@@ -477,90 +339,6 @@ export const FileDiffResponse = z.object({hasMore: z.boolean(),});-export type FileMagicMetadata = MagicMetadataCore<FilePrivateMagicMetadataData>;-export type FilePrivateMagicMetadata =- MagicMetadataCore<FilePrivateMagicMetadataData>;--export type FilePublicMagicMetadata =- MagicMetadataCore<FilePublicMagicMetadataData>;--export async function decryptFile(- file: EncryptedEnteFile,- collectionKey: string,-): Promise<EnteFile> {- try {- const worker = await sharedCryptoWorker();- const {- encryptedKey,- keyDecryptionNonce,- metadata,- magicMetadata,- pubMagicMetadata,- ...restFileProps- } = file;- const fileKey = await worker.decryptBox(- { encryptedData: encryptedKey, nonce: keyDecryptionNonce },- collectionKey,- );- const fileMetadata = await worker.decryptMetadataJSON(- // See: [Note: strict mode migration]- //- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- metadata,- fileKey,- );-- let fileMagicMetadata: FileMagicMetadata;- let filePubMagicMetadata: FilePublicMagicMetadata;- /* eslint-disable @typescript-eslint/no-unnecessary-condition */- if (magicMetadata?.data) {- fileMagicMetadata = {- ...file.magicMetadata,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- data: await worker.decryptMetadataJSON(- {- encryptedData: magicMetadata.data,- decryptionHeader: magicMetadata.header,- },- fileKey,- ),- };- }- /* eslint-disable @typescript-eslint/no-unnecessary-condition */- if (pubMagicMetadata?.data) {- filePubMagicMetadata = {- ...pubMagicMetadata,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- data: await worker.decryptMetadataJSON(- {- encryptedData: pubMagicMetadata.data,- decryptionHeader: pubMagicMetadata.header,- },- fileKey,- ),- };- }- return {- ...restFileProps,- key: fileKey,- // @ts-expect-error TODO: Need to use zod here.- metadata: fileMetadata,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- magicMetadata: fileMagicMetadata,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- pubMagicMetadata: filePubMagicMetadata,- };- } catch (e) {- log.error("file decryption failed", e);- throw e;- }-}-/*** Decrypt a remote file using the provided {@link collectionKey}.*@@ -575,7 +353,7 @@ export async function decryptFile(export const decryptRemoteFile = async (remoteFile: RemoteEnteFile,collectionKey: string,-): Promise<EnteFile2> => {+): Promise<EnteFile> => {// RemoteEnteFile is a looseObject, and we want to retain that semantic for// the parsed EnteFile. Mention all fields that we want to explicitly drop// or transform, passthrough the rest unchanged in the return value.@@ -611,7 +389,7 @@ export const decryptRemoteFile = async (transformDecryptedMetadataJSON(id, metadataJSON),);- let magicMetadata: EnteFile2["magicMetadata"];+ let magicMetadata: EnteFile["magicMetadata"];if (encryptedMagicMetadata) {const genericMM = await decryptMagicMetadata(encryptedMagicMetadata,@@ -621,7 +399,7 @@ export const decryptRemoteFile = async (magicMetadata = { ...genericMM, data };}- let pubMagicMetadata: EnteFile2["pubMagicMetadata"];+ let pubMagicMetadata: EnteFile["pubMagicMetadata"];if (encryptedPubMagicMetadata) {const genericMM = await decryptMagicMetadata(encryptedPubMagicMetadata,diff --git a/web/packages/new/photos/services/collections.ts b/web/packages/new/photos/services/collections.tsindex 904780279c..56b9157b0d 100644--- a/web/packages/new/photos/services/collections.ts+++ b/web/packages/new/photos/services/collections.ts@@ -6,7 +6,7 @@import log from "ente-base/log";import { apiURL } from "ente-base/origins";import { type Collection } from "ente-media/collection";-import { decryptFile, type EnteFile } from "ente-media/file";+import { decryptRemoteFile, type EnteFile } from "ente-media/file";import {getLocalTrash,getTrashedFiles,@@ -220,7 +220,7 @@ export async function syncTrash(deletedFileIDs.add(trashItem.file.id);}if (!trashItem.isDeleted && !trashItem.isRestored) {- const decryptedFile = await decryptFile(+ const decryptedFile = await decryptRemoteFile(trashItem.file,collectionKey,);diff --git a/web/packages/new/photos/services/file.ts b/web/packages/new/photos/services/file.tsindex e187d5c709..6106821e1c 100644--- a/web/packages/new/photos/services/file.ts+++ b/web/packages/new/photos/services/file.ts@@ -1,6 +1,6 @@import { authenticatedRequestHeaders, ensureOk } from "ente-base/http";import { apiURL } from "ente-base/origins";-import type { EnteFile, EnteFile2 } from "ente-media/file";+import type { EnteFile } from "ente-media/file";import type {FilePrivateMagicMetadataData,FilePublicMagicMetadataData,@@ -88,7 +88,7 @@ export const updateFilesVisibility = async (* See: [Note: Magic metadata data cannot have nullish values]*/const updateFilesPrivateMagicMetadata = async (- files: EnteFile2[],+ files: EnteFile[],updates: FilePrivateMagicMetadataData,) =>putFilesMagicMetadata({@@ -165,7 +165,7 @@ const putFilesMagicMetadata = async (** @param newFileName The new file name of the file.*/-export const updateFileFileName = (file: EnteFile2, newFileName: string) =>+export const updateFileFileName = (file: EnteFile, newFileName: string) =>updateFilePublicMagicMetadata(file, { editedName: newFileName });/**@@ -184,7 +184,7 @@ export const updateFileFileName = (file: EnteFile2, newFileName: string) =>* Fields in magic metadata cannot be removed after being added, so to reset the* caption to the default (no value) state pass a blank string.*/-export const updateFileCaption = (file: EnteFile2, caption: string) =>+export const updateFileCaption = (file: EnteFile, caption: string) =>updateFilePublicMagicMetadata(file, { caption });/**@@ -200,7 +200,7 @@ export const updateFileCaption = (file: EnteFile2, caption: string) =>* See: [Note: Magic metadata data cannot have nullish values]*/export const updateFilePublicMagicMetadata = async (- file: EnteFile2,+ file: EnteFile,updates: FilePublicMagicMetadataData,) => updateFilesPublicMagicMetadata([file], updates);@@ -213,7 +213,7 @@ export const updateFilePublicMagicMetadata = async (* the {@link pubMagicMetadata} of the given files.*/const updateFilesPublicMagicMetadata = async (- files: EnteFile2[],+ files: EnteFile[],updates: FilePublicMagicMetadataData,) =>putFilesPublicMagicMetadata({diff --git a/web/packages/new/photos/services/files.ts b/web/packages/new/photos/services/files.tsindex 214d79d366..20984aef8f 100644--- a/web/packages/new/photos/services/files.ts+++ b/web/packages/new/photos/services/files.ts@@ -4,10 +4,10 @@ import log from "ente-base/log";import { apiURL } from "ente-base/origins";import type { Collection } from "ente-media/collection";import {- decryptFile,+ decryptRemoteFile,mergeMetadata,- type EncryptedEnteFile,type EnteFile,+ type RemoteEnteFile,} from "ente-media/file";import { metadataHash } from "ente-media/file-metadata";import { type Trash } from "ente-new/photos/services/trash";@@ -123,9 +123,9 @@ export const getFiles = async (const newDecryptedFilesBatch = await Promise.all(// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access- resp.data.diff.map(async (file: EncryptedEnteFile) => {+ resp.data.diff.map(async (file: RemoteEnteFile) => {if (!file.isDeleted) {- return await decryptFile(file, collection.key);+ return await decryptRemoteFile(file, collection.key);} else {return file;}@@ -378,6 +378,8 @@ export function getLatestVersionFiles(files: EnteFile[]) {}});return Array.from(latestVersionFiles.values()).filter(- (file) => !file.isDeleted,+ // TODO(RE):+ // (file) => !file.isDeleted,+ (file) => !("isDeleted" in file && file.isDeleted),);}diff --git a/web/packages/new/photos/services/trash.ts b/web/packages/new/photos/services/trash.tsindex 0635e3a37b..7ddb27ed03 100644--- a/web/packages/new/photos/services/trash.ts+++ b/web/packages/new/photos/services/trash.ts@@ -1,11 +1,11 @@-import type { EncryptedEnteFile, EnteFile } from "ente-media/file";+import type { EnteFile, RemoteEnteFile } from "ente-media/file";export interface TrashItem extends Omit<EncryptedTrashItem, "file"> {file: EnteFile;}export interface EncryptedTrashItem {- file: EncryptedEnteFile;+ file: RemoteEnteFile;/*** `true` if the file no longer in trash because it was permanently deleted.*