rename variables
This commit is contained in:
parent
247cf8d2b5
commit
df565dbd4d
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue