const keyBytes = new Uint8Array(token.keyRaw); const cryptoKey = await crypto.subtle.importKey( "raw", keyBytes, name: "AES-GCM", length: 256 , false, ["decrypt"] ); const totalChunks = token.totalChunks; const decryptedChunks = []; for (let i = 0; i < totalChunks; i++) const ivArr = token.ivs[i]; const cipherArr = token.cipherChunks[i]; const decryptedBytes = await decryptChunk(cryptoKey, ivArr, cipherArr); decryptedChunks.push(decryptedBytes); const percent = ((i + 1) / totalChunks) * 100; receiverProgressFill.style.width = `$percent%`; receiverStatusDiv.innerHTML = `📀 Reconstructing chunk $i+1/$totalChunks...`;
return chunks;
WebRTC connections are encrypted by default via DTLS. const keyBytes = new Uint8Array(token
let selectedFile = null;