🐛 Fix decrypt transform
This commit is contained in:
parent
933134eb35
commit
8755fda1e3
1 changed files with 7 additions and 2 deletions
|
@ -4,8 +4,13 @@ import getDecryptor from '../decryption/decryptChunk';
|
||||||
export default function decryptTransform(decryptionKeys: [number, number, number]): stream.Transform {
|
export default function decryptTransform(decryptionKeys: [number, number, number]): stream.Transform {
|
||||||
const decryptor = getDecryptor(decryptionKeys);
|
const decryptor = getDecryptor(decryptionKeys);
|
||||||
const transform = new stream.Transform();
|
const transform = new stream.Transform();
|
||||||
|
//TODO: we need to set transform._transform = (chunk) => { return chunk; }
|
||||||
|
transform._transform = (chunk, encoding, callback) => {
|
||||||
|
const decryptedChunk = decryptor(chunk);
|
||||||
|
callback(undefined, decryptedChunk);
|
||||||
|
};
|
||||||
|
|
||||||
transform.on('readable', () => {
|
/*transform.on('readable', () => {
|
||||||
const encryptedChunk = transform.read();
|
const encryptedChunk = transform.read();
|
||||||
|
|
||||||
if (encryptedChunk === null) {
|
if (encryptedChunk === null) {
|
||||||
|
@ -16,7 +21,7 @@ export default function decryptTransform(decryptionKeys: [number, number, number
|
||||||
const decryptedChunk = decryptor(encryptedChunk);
|
const decryptedChunk = decryptor(encryptedChunk);
|
||||||
|
|
||||||
transform.write(decryptedChunk);
|
transform.write(decryptedChunk);
|
||||||
});
|
});*/
|
||||||
|
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue