π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Conv
Manav Rathieed1341003bb
diff --git a/web/packages/base/crypto/ente-impl.ts b/web/packages/base/crypto/ente-impl.tsindex b5f428d701..b391ef5d9e 100644--- a/web/packages/base/crypto/ente-impl.ts+++ b/web/packages/base/crypto/ente-impl.ts@@ -22,7 +22,6 @@ export const _initChunkEncryption = libsodium.initChunkEncryption;export const _encryptStreamChunk = libsodium.encryptStreamChunk;export const _decryptBox = libsodium.decryptBox;export const _decryptBoxBytes = libsodium.decryptBoxBytes;-export const _decryptBoxUTF8 = libsodium.decryptBoxUTF8;export const _decryptBlob = libsodium.decryptBlob;export const _decryptBlobBytes = libsodium.decryptBlobBytes;export const _decryptMetadataJSON = libsodium.decryptMetadataJSON;diff --git a/web/packages/base/crypto/index.ts b/web/packages/base/crypto/index.tsindex 4e45558314..ed644d1fd5 100644--- a/web/packages/base/crypto/index.ts+++ b/web/packages/base/crypto/index.ts@@ -344,19 +344,6 @@ export const decryptBoxBytes = (? ei._decryptBoxBytes(box, key): sharedWorker().then((w) => w.decryptBoxBytes(box, key));-/**- * Variant of {@link decryptBoxBytes} that returns the decrypted bytes as a- * "JavaScript string", specifically a UTF-8 string. That is, after decryption- * we obtain raw bytes, which we interpret as a UTF-8 string.- */-export const decryptBoxUTF8 = (- box: EncryptedBox,- key: BytesOrB64,-): Promise<string> =>- inWorker()- ? ei._decryptBoxUTF8(box, key)- : sharedWorker().then((w) => w.decryptBoxUTF8(box, key));-/*** Decrypt a blob encrypted using either {@link encryptBlobBytes} or* {@link encryptBlob} and return it as a base64 encoded string.diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.tsindex 094a165400..3871fdd169 100644--- a/web/packages/base/crypto/libsodium.ts+++ b/web/packages/base/crypto/libsodium.ts@@ -519,18 +519,6 @@ export const decryptBox = (key: BytesOrB64,): Promise<string> => decryptBoxBytes(box, key).then(toB64);-/**- * Variant of {@link decryptBoxBytes} that returns the data after decoding the- * decrypted bytes as a UTF-8 string.- */-export const decryptBoxUTF8 = async (- box: EncryptedBox,- key: BytesOrB64,-): Promise<string> => {- await sodium.ready;- return sodium.to_string(await decryptBoxBytes(box, key));-};-/*** Decrypt the result of {@link encryptBlobBytes} or {@link encryptBlob}.*/diff --git a/web/packages/base/crypto/worker.ts b/web/packages/base/crypto/worker.tsindex 22fa693d79..330a9b09e3 100644--- a/web/packages/base/crypto/worker.ts+++ b/web/packages/base/crypto/worker.ts@@ -30,7 +30,6 @@ export class CryptoWorker {encryptStreamChunk = ei._encryptStreamChunk;decryptBox = ei._decryptBox;decryptBoxBytes = ei._decryptBoxBytes;- decryptBoxUTF8 = ei._decryptBoxUTF8;decryptBlob = ei._decryptBlob;decryptBlobBytes = ei._decryptBlobBytes;decryptMetadataJSON = ei._decryptMetadataJSON;diff --git a/web/packages/new/photos/services/collections.ts b/web/packages/new/photos/services/collections.tsindex ed58b32544..3613615220 100644--- a/web/packages/new/photos/services/collections.ts+++ b/web/packages/new/photos/services/collections.ts@@ -226,13 +226,15 @@ export const getCollectionWithSecrets = async (}const collectionName =collection.name ||- (await cryptoWorker.decryptBoxUTF8(- {- encryptedData: collection.encryptedName,- nonce: collection.nameDecryptionNonce,- },- collectionKey,- ));+ new TextDecoder().decode(+ await cryptoWorker.decryptBoxBytes(+ {+ encryptedData: collection.encryptedName,+ nonce: collection.nameDecryptionNonce,+ },+ collectionKey,+ ),+ );let collectionMagicMetadata: CollectionMagicMetadata;if (collection.magicMetadata?.data) {