Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('fails to verify without having registered a passphrase', async () => {
const verificationCode = await appHelper.getVerificationCode('john@doe.com');
await bobLaptop.registerIdentity({ email: 'john@doe.com', verificationCode });
await expect(expectVerification(bobPhone, bobIdentity, { passphrase: 'my pass' })).to.be.rejectedWith(errors.PreconditionFailed);
});
it('fails to verify without having registered an email address', async () => {
await bobLaptop.registerIdentity({ passphrase: 'passphrase' });
const verificationCode = await appHelper.getVerificationCode('john@doe.com');
await expect(expectVerification(bobPhone, bobIdentity, { email: 'john@doe.com', verificationCode })).to.be.rejectedWith(errors.PreconditionFailed);
});
});
it('throws when registering before having started a session', async () => {
await expect(bobLaptop.registerIdentity({ passphrase: 'passphrase' })).to.be.rejectedWith(errors.PreconditionFailed);
});
it('should throw when using a session in an invalid state', async () => {
await bobLaptop.stop();
await expect(bobLaptop.getDeviceList()).to.be.rejectedWith(errors.PreconditionFailed);
});
it('throws when decrypting using a session in an invalid state', async () => {
await expect(bobLaptop.decrypt(utils.fromString('test'))).to.be.rejectedWith(errors.PreconditionFailed);
});
});
it('throws when using a session in an invalid state', async () => {
await expect(bobLaptop.encrypt(clearText)).to.be.rejectedWith(errors.PreconditionFailed);
});