Action-Based MFA requires users to verify their identity for sensitive actions like transactions.
By default, we only require action-based MFA once the user already has an MFA method registered.
Waas Export — When exporting a private key on an MPC wallet.
Waas Refresh — When a wallet is delegated, or when a user claims a pregenerated MPC wallet for the first time.
WaaS Sign — When any signature is performed i.e. a message, a transaction, typed data, authorization, etc.
WaaS Reshare — When a wallet is approved or revoked from delegated access and the user next signs in.
Using step-up authentication (recommended)
Use requestedScopes to receive elevated access tokens instead of legacy MFA tokens. This is the recommended approach and will be required in the next major version.
TOTP
Passkey
import { isMfaRequiredForAction, authenticateTotpMfaDevice, MFAAction, TokenScope,} from '@dynamic-labs-sdk/client';import { exportWaasPrivateKey } from '@dynamic-labs-sdk/client/waas';const onExportPrivateKeyClick = async () => { const required = await isMfaRequiredForAction({ mfaAction: MFAAction.WalletWaasExport }); if (required) { await authenticateTotpMfaDevice({ code: '123456', requestedScopes: [TokenScope.Walletexport], }); } // Elevated token is now stored — the SDK attaches it automatically await exportWaasPrivateKey(params);};
import { isMfaRequiredForAction, authenticatePasskeyMFA, MFAAction, TokenScope,} from '@dynamic-labs-sdk/client';import { exportWaasPrivateKey } from '@dynamic-labs-sdk/client/waas';const onExportPrivateKeyClick = async () => { const required = await isMfaRequiredForAction({ mfaAction: MFAAction.WalletWaasExport }); if (required) { await authenticatePasskeyMFA({ requestedScopes: [TokenScope.Walletexport], }); } // Elevated token is now stored — the SDK attaches it automatically await exportWaasPrivateKey(params);};
For a complete guide on step-up authentication including all verification methods, see Step-Up Authentication.
React
In React, use useAuthenticateTotpMfaDevice for the MFA challenge and call the one-shot isMfaRequiredForAction check directly inside your handler before the sensitive operation:
createMfaToken and createMfaTokenOptions are deprecated and will be removed in the next major version. Use requestedScopes instead. See migration guide.