UNPKG

@web3auth/modal

Version:

Multi chain wallet aggregator for web3Auth

56 lines (52 loc) 1.51 kB
'use strict'; var _objectSpread = require('@babel/runtime/helpers/objectSpread2'); var AbstractHandler = require('./AbstractHandler.js'); class SmsPasswordlessHandler extends AbstractHandler.PasswordlessHandler { constructor(params) { super(params); if (this.sessionStorageAvailable) { var _window$sessionStorag; 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 = _objectSpread({ client_id: web3authClientId, web3auth_client_id: web3authClientId, connection: this.connection, login_hint: loginHint, tracking_id: this.trackingId, whitelabel: this.whiteLabelParams, version: this.version, network }, captchaToken && { 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: this.connection, tracking_id: this.trackingId, version: this.version, network }; return super.verify(params); } } module.exports = SmsPasswordlessHandler;