Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

New and fold

Manav Rathi9422398922de
diff --git a/web/packages/base/crypto/ente-impl.ts b/web/packages/base/crypto/ente-impl.ts
index a5c5b93c0e..6339a306ae 100644
--- a/web/packages/base/crypto/ente-impl.ts
+++ b/web/packages/base/crypto/ente-impl.ts
@@ -23,8 +23,6 @@ export const _encryptThumbnail = _encryptAssociatedData;
export const _encryptAssociatedB64Data = (r: EncryptBytes) =>
_encryptAssociatedData(r).then(EncryptedBytesToB64);
-export const _encryptFileEmbedding = _encryptAssociatedB64Data;
-
export const _encryptMetadataJSON = ({ jsonValue, keyB64 }: EncryptJSON) =>
_encryptAssociatedB64Data({
data: new TextEncoder().encode(JSON.stringify(jsonValue)),
@@ -46,8 +44,6 @@ export const _decryptAssociatedB64Data = async ({
keyB64,
});
-export const _decryptFileEmbedding = _decryptAssociatedB64Data;
-
export const _decryptMetadataJSON = async (r: DecryptB64) =>
JSON.parse(
new TextDecoder().decode(await _decryptAssociatedB64Data(r)),
diff --git a/web/packages/base/crypto/ente.ts b/web/packages/base/crypto/ente.ts
index 0a2b394f94..b5e7fa0c1e 100644
--- a/web/packages/base/crypto/ente.ts
+++ b/web/packages/base/crypto/ente.ts
@@ -87,7 +87,7 @@ export const encryptAssociatedData = (r: EncryptBytes) =>
*
* This is just an alias for {@link encryptAssociatedData}.
*
- * Use {@link decryptFileEmbedding} to decrypt the result.
+ * Use {@link decryptThumbnail} to decrypt the result.
*/
export const encryptThumbnail = (r: EncryptBytes) =>
assertInWorker(ei._encryptThumbnail(r));
@@ -101,16 +101,6 @@ export const encryptThumbnail = (r: EncryptBytes) =>
export const encryptAssociatedB64Data = (r: EncryptBytes) =>
assertInWorker(ei._encryptAssociatedB64Data(r));
-/**
- * Encrypted the embedding associated with a file using the file's key.
- *
- * This is just an alias for {@link encryptAssociatedB64Data}.
- *
- * Use {@link decryptFileEmbedding} to decrypt the result.
- */
-export const encryptFileEmbedding = async (r: EncryptBytes) =>
- assertInWorker(ei._encryptFileEmbedding(r));
-
/**
* Encrypt the JSON metadata associated with an Ente object (file, collection or
* entity) using the object's key.
@@ -160,15 +150,6 @@ export const decryptAssociatedB64Data = (r: DecryptB64) =>
inWorker()
? ei._decryptAssociatedB64Data(r)
: sharedCryptoWorker().then((w) => w.decryptAssociatedB64Data(r));
-
-/**
- * Decrypt the embedding associated with a file using the file's key.
- *
- * This is the sibling of {@link encryptFileEmbedding}.
- */
-export const decryptFileEmbedding = async (r: DecryptB64) =>
- assertInWorker(ei._decryptFileEmbedding(r));
-
/**
* Decrypt the metadata JSON associated with an Ente object.
*
diff --git a/web/packages/new/photos/services/file-data.ts b/web/packages/new/photos/services/file-data.ts
index 6e4967ee36..8fd35da830 100644
--- a/web/packages/new/photos/services/file-data.ts
+++ b/web/packages/new/photos/services/file-data.ts
@@ -1,4 +1,4 @@
-import { encryptFileEmbedding } from "@/base/crypto/ente";
+import { encryptAssociatedB64Data } from "@/base/crypto/ente";
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
import { apiURL } from "@/base/origins";
import type { EnteFile } from "@/new/photos/types/file";
@@ -95,7 +95,7 @@ export const putFileData = async (
data: Uint8Array,
) => {
const { encryptedDataB64, decryptionHeaderB64 } =
- await encryptFileEmbedding({ data: data, keyB64: enteFile.key });
+ await encryptAssociatedB64Data({ data: data, keyB64: enteFile.key });
const res = await fetch(await apiURL("/files/data"), {
method: "PUT",
diff --git a/web/packages/new/photos/services/ml/ml-data.ts b/web/packages/new/photos/services/ml/ml-data.ts
index 154e78630c..2956b9dea2 100644
--- a/web/packages/new/photos/services/ml/ml-data.ts
+++ b/web/packages/new/photos/services/ml/ml-data.ts
@@ -1,4 +1,4 @@
-import { decryptFileEmbedding } from "@/base/crypto/ente";
+import { decryptAssociatedB64Data } from "@/base/crypto/ente";
import log from "@/base/log";
import type { EnteFile } from "@/new/photos/types/file";
import { nullToUndefined } from "@/utils/transform";
@@ -172,7 +172,7 @@ export const fetchMLData = async (
}
try {
- const decryptedBytes = await decryptFileEmbedding({
+ const decryptedBytes = await decryptAssociatedB64Data({
encryptedDataB64: remoteFileData.encryptedData,
decryptionHeaderB64: remoteFileData.decryptionHeader,
keyB64: file.key,