Skip to content

armgit / ente

Public Imported from GitHub
0

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

Cast: simplify ascii to base64 conversion

Neeraj Gupta8efa92fa950d
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 074e180a5d..74739151bc 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -13,5 +13,8 @@
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
- "typescript.enablePromptUseWorkspaceTsdk": true
+ "typescript.enablePromptUseWorkspaceTsdk": true,
+ "[typescript]": {
+ "editor.defaultFormatter": "vscode.typescript-language-features"
+ }
}
diff --git a/apps/cast/src/pages/index.tsx b/apps/cast/src/pages/index.tsx
index b1d9affa43..65c3671da6 100644
--- a/apps/cast/src/pages/index.tsx
+++ b/apps/cast/src/pages/index.tsx
@@ -1,9 +1,5 @@
import EnteSpinner from '@ente/shared/components/EnteSpinner';
-import {
- boxSealOpen,
- fromB64,
- toB64,
-} from '@ente/shared/crypto/internal/libsodium';
+import { boxSealOpen, toB64 } from '@ente/shared/crypto/internal/libsodium';
import { useCastReceiver } from '@ente/shared/hooks/useCastReceiver';
import castGateway from '@ente/shared/network/cast';
import LargeType from 'components/LargeType';
@@ -123,11 +119,7 @@ export default function PairingMode() {
privateKeyB64
);
- const nonB64 = await fromB64(decryptedPayload);
-
- const decryptedPayloadObj = JSON.parse(
- new TextDecoder().decode(nonB64)
- );
+ const decryptedPayloadObj = JSON.parse(atob(decryptedPayload));
return decryptedPayloadObj;
};
diff --git a/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx b/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
index 0a36679d3c..6219d32c45 100644
--- a/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
+++ b/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
@@ -5,7 +5,7 @@ import EnteSpinner from '@ente/shared/components/EnteSpinner';
import SingleInputForm, {
SingleInputFormProps,
} from '@ente/shared/components/SingleInputForm';
-import { boxSeal, toB64 } from '@ente/shared/crypto/internal/libsodium';
+import { boxSeal } from '@ente/shared/crypto/internal/libsodium';
import { loadSender } from '@ente/shared/hooks/useCastSender';
import { addLogLine } from '@ente/shared/logging';
import castGateway from '@ente/shared/network/cast';
@@ -83,11 +83,7 @@ export default function AlbumCastDialog(props: Props) {
collectionID: props.currentCollection.id,
collectionKey: props.currentCollection.key,
});
-
- const encryptedPayload = await boxSeal(
- await toB64(new TextEncoder().encode(payload)),
- tvPublicKeyB64
- );
+ const encryptedPayload = await boxSeal(btoa(payload), tvPublicKeyB64);
// hey TV, we acknowlege you!
await castGateway.publishCastPayload(