Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async initTanker() {
if (!this.user) throw new Error('Assertion error: cannot start Tanker without a user');
const config = await this.serverApi.tankerConfig();
this.tanker = new Tanker(config);
const result = await this.tanker.start(this.user.identity);
if (result === READY) {
await this.triggerClaimIfNeeded();
} else if (result === IDENTITY_REGISTRATION_NEEDED) {
this.status = 'register';
} else if (result === IDENTITY_VERIFICATION_NEEDED) {
this.status = 'verify';
} else {
throw new Error(`Unexpected status ${result}`);
}
}
createIdentity(appId, appSecret, userId).then(async identity => {
const provisionalIdentity = await createProvisionalIdentity(appId, email);
const tanker = new Tanker({ appId, url });
const verificationUI = new VerificationUI(tanker);
await verificationUI.start(email, identity, provisionalIdentity);
});
constructor(config: TankerOptions) {
this.tanker = new Tanker(config);
this.verificationUI = new VerificationUI(this.tanker);
}