Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('throws when calling decrypt with a corrupted buffer (data)', async () => {
const encrypted = await bobLaptop.encrypt(clearText);
const corruptPos = 4;
encrypted[corruptPos] = (encrypted[corruptPos] + 1) % 256;
await expect(bobLaptop.decrypt(encrypted)).to.be.rejectedWith(errors.DecryptionFailed);
});