Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove unused sealed box decryption helpers

Neeraj Gupta56e16e591705
diff --git a/web/packages/base/crypto/index.ts b/web/packages/base/crypto/index.ts
index 49affbf097..c29df722a9 100644
--- a/web/packages/base/crypto/index.ts
+++ b/web/packages/base/crypto/index.ts
@@ -12,7 +12,6 @@ import type {
EncryptedBoxB64,
EncryptedFile,
InitChunkDecryptionResult,
- KeyPair,
SodiumStateAddress,
} from "./types";
import type { CryptoWorker } from "./worker";
@@ -150,16 +149,6 @@ export const boxSeal = (data: string, publicKey: string): Promise<string> =>
? libsodium.boxSeal(data, publicKey)
: sharedWorker().then((w) => w.boxSeal(data, publicKey));
-export const boxSealOpenBytes = (
- encryptedData: string,
- keyPair: KeyPair,
-): Promise<Uint8Array> =>
- inWorker()
- ? libsodium.boxSealOpenBytes(encryptedData, keyPair)
- : sharedWorker().then((w) =>
- w.boxSealOpenBytes(encryptedData, keyPair),
- );
-
export const deriveKey = (
passphrase: string,
salt: string,
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index 5b50c4ac73..2ac8a5f0bc 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -13,7 +13,6 @@ import {
type EncryptedFile,
type InitChunkDecryptionResult,
type InitChunkEncryptionResult,
- type KeyPair,
type SodiumStateAddress,
} from "./types";
@@ -327,20 +326,6 @@ export const boxSeal = async (data: string, publicKey: string) => {
);
};
-export const boxSealOpenBytes = async (
- encryptedData: string,
- { publicKey, privateKey }: KeyPair,
-): Promise<Uint8Array<ArrayBuffer>> => {
- await sodium.ready;
- return ensureArrayBufferBacked(
- sodium.crypto_box_seal_open(
- await fromB64(encryptedData),
- await fromB64(publicKey),
- await fromB64(privateKey),
- ),
- );
-};
-
const generateDeriveKeySalt = async () => {
await sodium.ready;
return await toB64(sodium.randombytes_buf(sodium.crypto_pwhash_SALTBYTES));
diff --git a/web/packages/base/crypto/types.ts b/web/packages/base/crypto/types.ts
index 18cf3d52f6..0fe6f4e04a 100644
--- a/web/packages/base/crypto/types.ts
+++ b/web/packages/base/crypto/types.ts
@@ -49,11 +49,6 @@ export interface InitChunkDecryptionResult {
decryptionChunkSize: number;
}
-export interface KeyPair {
- publicKey: string;
- privateKey: string;
-}
-
export interface DerivedKey {
key: string;
salt: string;
diff --git a/web/packages/base/crypto/worker.ts b/web/packages/base/crypto/worker.ts
index 411c374271..eef10627b3 100644
--- a/web/packages/base/crypto/worker.ts
+++ b/web/packages/base/crypto/worker.ts
@@ -29,7 +29,6 @@ export class CryptoWorker {
chunkHashUpdate = libsodium.chunkHashUpdate;
chunkHashFinal = libsodium.chunkHashFinal;
boxSeal = libsodium.boxSeal;
- boxSealOpenBytes = libsodium.boxSealOpenBytes;
deriveKey = libsodium.deriveKey;
deriveInteractiveKey = libsodium.deriveInteractiveKey;
}