How to use the @tanker/core.errors.PreconditionFailed function in @tanker/core

To help you get started, we’ve selected a few @tanker/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TankerHQ / sdk-js / packages / functional-tests / src / verification.js View on Github external
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);
      });
github TankerHQ / sdk-js / packages / functional-tests / src / verification.js View on Github external
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);
      });
    });
github TankerHQ / sdk-js / packages / functional-tests / src / start.js View on Github external
it('throws when registering before having started a session', async () => {
      await expect(bobLaptop.registerIdentity({ passphrase: 'passphrase' })).to.be.rejectedWith(errors.PreconditionFailed);
    });
github TankerHQ / sdk-js / packages / functional-tests / src / getDeviceList.js View on Github external
it('should throw when using a session in an invalid state', async () => {
      await bobLaptop.stop();
      await expect(bobLaptop.getDeviceList()).to.be.rejectedWith(errors.PreconditionFailed);
    });
github TankerHQ / sdk-js / packages / functional-tests / src / encrypt.js View on Github external
it('throws when decrypting using a session in an invalid state', async () => {
      await expect(bobLaptop.decrypt(utils.fromString('test'))).to.be.rejectedWith(errors.PreconditionFailed);
    });
  });
github TankerHQ / sdk-js / packages / functional-tests / src / encrypt.js View on Github external
it('throws when using a session in an invalid state', async () => {
      await expect(bobLaptop.encrypt(clearText)).to.be.rejectedWith(errors.PreconditionFailed);
    });