UNPKG

@web3auth/modal

Version:

Multi chain wallet aggregator for web3Auth

19 lines (15 loc) 786 B
'use strict'; var auth = require('@web3auth/auth'); var noModal = require('@web3auth/no-modal'); const EMAIL_TEST_ACCOUNT_PREFIX = "test_account_"; const EMAIL_TEST_ACCOUNT_POSTFIX = "@example.com"; const PHONE_TEST_ACCOUNT_PREFIX = "+1-555"; const isTestAccountPattern = (authConnection, loginHint) => { if (authConnection === auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS) { return loginHint.startsWith(EMAIL_TEST_ACCOUNT_PREFIX) && loginHint.endsWith(EMAIL_TEST_ACCOUNT_POSTFIX); } else if (authConnection === auth.AUTH_CONNECTION.SMS_PASSWORDLESS) { return loginHint.startsWith(PHONE_TEST_ACCOUNT_PREFIX); } throw noModal.WalletInitializationError.invalidParams(`Unsupported auth connection: ${authConnection}`); }; exports.isTestAccountPattern = isTestAccountPattern;