Skip to content

armgit / ente

Public Imported from GitHub
0

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

Mig

Manav Rathi069cf82bbb14
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index a7cce5710a..f1972de6be 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -13,7 +13,6 @@ import { CustomError } from "@ente/shared/error";
import sodium, { type StateAddress } from "libsodium-wrappers";
import type {
BytesOrB64,
- DecryptBoxBytes,
EncryptBytes,
EncryptedBlob_2,
EncryptedBlobB64_2,
@@ -135,7 +134,7 @@ const bytes = async (bob: BytesOrB64) =>
* Encrypt the given data using libsodium's secretbox APIs, using a randomly
* generated nonce.
*
- * Use {@link decryptBox} to decrypt the result.
+ * Use {@link decryptBox_Deprecated} to decrypt the result.
*
* @param data The data to encrypt.
*
@@ -388,11 +387,15 @@ export async function encryptFileChunk(
/**
* Decrypt the result of {@link encryptBox}.
*/
-export const decryptBox = async ({
+const decryptBox_Deprecated = async ({
encryptedData,
nonceB64,
keyB64,
-}: DecryptBoxBytes): Promise<Uint8Array> => {
+}: {
+ encryptedData: Uint8Array;
+ nonceB64: string;
+ keyB64: string;
+}): Promise<Uint8Array> => {
await sodium.ready;
return sodium.crypto_secretbox_open_easy(
encryptedData,
@@ -417,7 +420,7 @@ export const decryptBox2 = async (
};
/**
- * Variant of {@link decryptBox} that returns the data as a base64 string.
+ * Variant of {@link decryptBox_Deprecated} that returns the data as a base64 string.
*/
export const decryptBoxB64 = (
box: EncryptedBox2,
@@ -557,7 +560,7 @@ export async function decryptB64(
keyB64: string,
) {
await sodium.ready;
- const decrypted = await decryptBox({
+ const decrypted = await decryptBox_Deprecated({
encryptedData: await fromB64(data),
nonceB64,
keyB64,
@@ -573,7 +576,7 @@ export async function decryptToUTF8(
keyB64: string,
) {
await sodium.ready;
- const decrypted = await decryptBox({
+ const decrypted = await decryptBox_Deprecated({
encryptedData: await fromB64(data),
nonceB64,
keyB64,
diff --git a/web/packages/base/crypto/types.ts b/web/packages/base/crypto/types.ts
index 64d01576f7..ea35e23f49 100644
--- a/web/packages/base/crypto/types.ts
+++ b/web/packages/base/crypto/types.ts
@@ -162,52 +162,6 @@ export interface EncryptedBoxBytes {
nonceB64: string;
}
-/**
- * A decryption request to decrypt data encrypted using the secretbox APIs. The
- * encrypted Box's data is provided as bytes.
- *
- * See: [Note: 3 forms of encryption (Box | Blob | Stream)].
- */
-export interface DecryptBoxBytes {
- /**
- * A {@link Uint8Array} containing the bytes to decrypt.
- */
- encryptedData: Uint8Array;
- /**
- * A base64 string containing the nonce that was used during encryption.
- *
- * The nonce is required to decrypt the data, but it does not need to be
- * kept secret.
- */
- nonceB64: string;
- /**
- * A base64 string containing the encryption key.
- */
- keyB64: string;
-}
-
-/**
- * A variant of {@link DecryptBoxBytes} with the encrypted Blob's data as a
- * base64 encoded string.
- */
-export interface DecryptBoxB64 {
- /**
- * A base64 string containing the data to decrypt.
- */
- encryptedDataB64: string;
- /**
- * A base64 string containing the nonce that was used during encryption.
- *
- * The nonce is required to decrypt the data, but it does not need to be
- * kept secret.
- */
- nonceB64: string;
- /**
- * A base64 string containing the encryption key.
- */
- keyB64: string;
-}
-
/**
* Deprecated.
*