rename variables

This commit is contained in:
Abhinav 2023-02-28 11:59:29 +05:30
parent 247cf8d2b5
commit df565dbd4d
4 changed files with 13 additions and 10 deletions

View file

@ -207,7 +207,7 @@ class DownloadManager {
); );
const fileKey = await cryptoWorker.fromB64(file.key); const fileKey = await cryptoWorker.fromB64(file.key);
const { pullState, decryptionChunkSize } = const { pullState, decryptionChunkSize } =
await cryptoWorker.initDecryption( await cryptoWorker.initChunkDecryption(
decryptionHeader, decryptionHeader,
fileKey fileKey
); );
@ -229,7 +229,7 @@ class DownloadManager {
decryptionChunkSize decryptionChunkSize
); );
const { decryptedData } = const { decryptedData } =
await cryptoWorker.decryptChunk( await cryptoWorker.decryptFileChunk(
fileData, fileData,
pullState pullState
); );
@ -242,7 +242,7 @@ class DownloadManager {
} else { } else {
if (data) { if (data) {
const { decryptedData } = const { decryptedData } =
await cryptoWorker.decryptChunk( await cryptoWorker.decryptFileChunk(
data, data,
pullState pullState
); );

View file

@ -214,7 +214,7 @@ class PublicCollectionDownloadManager {
); );
const fileKey = await cryptoWorker.fromB64(file.key); const fileKey = await cryptoWorker.fromB64(file.key);
const { pullState, decryptionChunkSize } = const { pullState, decryptionChunkSize } =
await cryptoWorker.initDecryption( await cryptoWorker.initChunkDecryption(
decryptionHeader, decryptionHeader,
fileKey fileKey
); );
@ -236,7 +236,7 @@ class PublicCollectionDownloadManager {
decryptionChunkSize decryptionChunkSize
); );
const { decryptedData } = const { decryptedData } =
await cryptoWorker.decryptChunk( await cryptoWorker.decryptFileChunk(
fileData, fileData,
pullState pullState
); );
@ -249,7 +249,7 @@ class PublicCollectionDownloadManager {
} else { } else {
if (data) { if (data) {
const { decryptedData } = const { decryptedData } =
await cryptoWorker.decryptChunk( await cryptoWorker.decryptFileChunk(
data, data,
pullState pullState
); );

View file

@ -69,7 +69,10 @@ export async function initChunkDecryption(header: Uint8Array, key: Uint8Array) {
return { pullState, decryptionChunkSize, tag }; return { pullState, decryptionChunkSize, tag };
} }
export async function decryptChunk(data: Uint8Array, pullState: StateAddress) { export async function decryptFileChunk(
data: Uint8Array,
pullState: StateAddress
) {
await sodium.ready; await sodium.ready;
const pullResult = sodium.crypto_secretstream_xchacha20poly1305_pull( const pullResult = sodium.crypto_secretstream_xchacha20poly1305_pull(
pullState, pullState,

View file

@ -65,12 +65,12 @@ export class DedicatedCryptoWorker {
return libsodium.initChunkEncryption(); return libsodium.initChunkEncryption();
} }
async initDecryption(header: Uint8Array, key: Uint8Array) { async initChunkDecryption(header: Uint8Array, key: Uint8Array) {
return libsodium.initChunkDecryption(header, key); return libsodium.initChunkDecryption(header, key);
} }
async decryptChunk(fileData: Uint8Array, pullState: StateAddress) { async decryptFileChunk(fileData: Uint8Array, pullState: StateAddress) {
return libsodium.decryptChunk(fileData, pullState); return libsodium.decryptFileChunk(fileData, pullState);
} }
async initChunkHashing() { async initChunkHashing() {