UNPKG

@web3auth/modal

Version:

Multi chain wallet aggregator for web3Auth

58 lines (54 loc) 1.64 kB
'use strict'; var _defineProperty = require('@babel/runtime/helpers/defineProperty'); var auth = require('@web3auth/auth'); var AbstractHandler = require('./AbstractHandler.js'); class EmailPasswordlessHandler extends AbstractHandler.PasswordlessHandler { constructor(params) { var _window$sessionStorag; super(params); _defineProperty(this, "mailSent", void 0); this.mailSent = false; if (this.sessionStorageAvailable) this.trackingId = (_window$sessionStorag = window.sessionStorage.getItem("trackingId")) !== null && _window$sessionStorag !== void 0 ? _window$sessionStorag : undefined; } async sendVerificationCode({ captchaToken }) { const { loginHint, network, web3authClientId } = this.passwordlessParams; const finalParams = { client_id: web3authClientId, web3auth_client_id: web3authClientId, connection: this.connection, login_hint: loginHint, tracking_id: this.trackingId, whitelabel: this.whiteLabelParams, version: this.version, network, flow_type: auth.EMAIL_FLOW.code, captcha_token: captchaToken }; return super.start(finalParams); } async verifyCode(code) { const { loginHint, network, web3authClientId } = this.passwordlessParams; const params = { client_id: web3authClientId, login_hint: loginHint, code, connection: "email", tracking_id: this.trackingId, version: this.version, network, flow_type: auth.EMAIL_FLOW.code }; return super.verify(params); } } module.exports = EmailPasswordlessHandler;