π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
R1
Manav Rathif9b67e21970d
diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.tsindex d4d7390c1c..1e4a507329 100644--- a/web/packages/gallery/services/upload/upload-service.ts+++ b/web/packages/gallery/services/upload/upload-service.ts@@ -33,7 +33,7 @@ import type {EnteFile,FilePublicMagicMetadata,FilePublicMagicMetadataProps,- MetadataFileAttributes,+ RemoteFileMetadata,S3FileAttributes,} from "ente-media/file";import {@@ -350,7 +350,7 @@ interface EncryptedFilePieces {export interface BackupedFile {file: S3FileAttributes;thumbnail: S3FileAttributes;- metadata: MetadataFileAttributes;+ metadata: RemoteFileMetadata;pubMagicMetadata: EncryptedMagicMetadata;}diff --git a/web/packages/media/file-metadata.ts b/web/packages/media/file-metadata.tsindex 953239e8bb..55bdbc4f77 100644--- a/web/packages/media/file-metadata.ts+++ b/web/packages/media/file-metadata.ts@@ -18,6 +18,8 @@ import type { RemoteMagicMetadata } from "./magic-metadata";/*** Information about the file that never changes post upload.*+ * ---+ ** [Note: Metadatum]** There are three different sources of metadata relating to a file.@@ -85,6 +87,8 @@ import type { RemoteMagicMetadata } from "./magic-metadata";export interface Metadata {/*** The "Ente" file type - image, video or live photo.+ *+ * Expected to be one of {@link FileType}.*/fileType: FileType;/**@@ -165,9 +169,23 @@ export interface Metadata {* sub-second fraction.*/duration?: number;+ /**+ * `true` if the uploading client was unable to generate a thumbnail for the+ * file when uploading it (e.g. unsupported format), and so instead a+ * placeholder thumbnail was used.+ */hasStaticThumbnail?: boolean;+ /**+ * Mobile client specific field, not used by us.+ */localID?: number;+ /**+ * Mobile client specific field, not used by us.+ */version?: number;+ /**+ * Mobile client specific field, not used by us.+ */deviceFolder?: string;}diff --git a/web/packages/media/file.ts b/web/packages/media/file.tsindex 6dbe12ab9a..45b16724b8 100644--- a/web/packages/media/file.ts+++ b/web/packages/media/file.ts@@ -46,7 +46,7 @@ export interface EncryptedEnteFile {ownerID: number;file: S3FileAttributes;thumbnail: S3FileAttributes;- metadata: MetadataFileAttributes;+ metadata: RemoteFileMetadata;/*** Static, remote visible, information associated with a file.*@@ -171,11 +171,6 @@ export interface EnteFiledeleteBy?: number;}-export interface MetadataFileAttributes {- encryptedData: string;- decryptionHeader: string;-}-/*** Attributes about an object uploaded to S3.*@@ -226,6 +221,23 @@ const RemoteFileInfo = z.looseObject({thumbSize: z.number(),});+const RemoteFileMetadata = z.object({+ /**+ * The metadata JSON object associated with the file, encrypted using the+ * file's key.+ *+ * Base64 encoded.+ */+ encryptedData: z.string(),+ /**+ * The base64 encoded decryption header that was used during encryption of+ * {@link encryptedData}.+ */+ decryptionHeader: z.string(),+});++export type RemoteFileMetadata = z.infer<typeof RemoteFileMetadata>;+/*** Zod schema for a {@link EnteFile} as represented in our interactions with* remote.@@ -261,11 +273,11 @@ export const RemoteEnteFile = z.looseObject({/*** Tombstone marker.*- * This is set to true in the diff response to indicate files which- * have been deleted and should thus be pruned by the client locally.+ * This is set to true in the diff response to indicate files which have+ * been deleted and should thus be pruned by the client locally.*/isDeleted: z.boolean().nullish().transform(nullToUndefined),- metadata: z.unknown(),+ metadata: RemoteFileMetadata,magicMetadata: RemoteMagicMetadata.nullish().transform(nullToUndefined),pubMagicMetadata: RemoteMagicMetadata.nullish().transform(nullToUndefined),isTrashed: z.boolean().nullish().transform(nullToUndefined),