π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Decode Photos social data from decrypted bytes
Manav Rathi250ad84584ff
diff --git a/web/packages/new/photos/services/social.ts b/web/packages/new/photos/services/social.tsindex 07eaec42de..8519bb6422 100644--- a/web/packages/new/photos/services/social.ts+++ b/web/packages/new/photos/services/social.ts@@ -1,4 +1,4 @@-import { decryptBox } from "ente-base/crypto";+import { decryptBoxBytes } from "ente-base/crypto";import { authenticatedRequestHeaders, ensureOk } from "ente-base/http";import { apiURL } from "ente-base/origins";import { z } from "zod";@@ -90,13 +90,11 @@ const decryptSocialDiff = async (continue;}try {- const decryptedB64 = await decryptBox(+ const decrypted = await decryptBoxBytes({ encryptedData: comment.cipher, nonce: comment.nonce },collectionKey,);- const text = new TextDecoder().decode(- Uint8Array.from(atob(decryptedB64), (c) => c.charCodeAt(0)),- );+ const text = new TextDecoder().decode(decrypted);const decryptedComment = {id: comment.id,collectionID: comment.collectionID,@@ -120,14 +118,12 @@ const decryptSocialDiff = async (for (const reaction of data.reactions) {if (reaction.isDeleted || !reaction.cipher || !reaction.nonce) continue;try {- const decryptedB64 = await decryptBox(+ const decrypted = await decryptBoxBytes({ encryptedData: reaction.cipher, nonce: reaction.nonce },collectionKey,);const reactionType = unpadReaction(- new TextDecoder().decode(- Uint8Array.from(atob(decryptedB64), (c) => c.charCodeAt(0)),- ),+ new TextDecoder().decode(decrypted),);reactions.push({id: reaction.id,@@ -208,13 +204,11 @@ export const getAnonProfiles = async (for (const profile of profiles) {if (!profile.cipher || !profile.nonce) continue;try {- const decryptedB64 = await decryptBox(+ const decrypted = await decryptBoxBytes({ encryptedData: profile.cipher, nonce: profile.nonce },collectionKey,);- const userName = new TextDecoder().decode(- Uint8Array.from(atob(decryptedB64), (c) => c.charCodeAt(0)),- );+ const userName = new TextDecoder().decode(decrypted);if (userName) {anonUserNames.set(profile.anonUserID, userName);}