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 { pullState, decryptionChunkSize } =
await cryptoWorker.initDecryption(
await cryptoWorker.initChunkDecryption(
decryptionHeader,
fileKey
);
@ -229,7 +229,7 @@ class DownloadManager {
decryptionChunkSize
);
const { decryptedData } =
await cryptoWorker.decryptChunk(
await cryptoWorker.decryptFileChunk(
fileData,
pullState
);
@ -242,7 +242,7 @@ class DownloadManager {
} else {
if (data) {
const { decryptedData } =
await cryptoWorker.decryptChunk(
await cryptoWorker.decryptFileChunk(
data,
pullState
);

View file

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

View file

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

View file

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