Implementing secure wallet recovery with Two-Factor Authentication in Para
Para supports Two-Factor Authentication (2FA) to enhance wallet recovery security by requiring users to provide two different authentication factors when verifying their identity.
Begin by checking if 2FA is already enabled for the user:
const checkTwoFactorStatus = async () => { const { isSetup } = await para.check2FAStatus(); if (isSetup) { // 2FA is already set up - proceed to verification if needed } else { // 2FA needs to be set up - proceed to setup flow }};
If 2FA isn’t configured, initiate the setup process:
const setupTwoFactor = async () => { const { uri } = await para.setup2FA(); if (uri) { // Display the QR code to the user or provide the secret for manual entry } else { // Handle case where no URI is returned }};
The returned uri can be used to generate a QR code or extracted to provide the secret key. Most authenticator apps
(like Google Authenticator, Authy, or Microsoft Authenticator) can scan this QR code directly.