enableMfa method

  1. @override
Future<void> enableMfa(
  1. String totp
)

Enable MFA (Multi-Factor Authentication).

totp is the one-time password generated from an OTP secret, which is created via the generateMfa call.

Throws an NhostException if enabling MFA fails.

Implementation

@override
Future<void> enableMfa(String totp) async {
  await _apiClient.post(
    '/user/mfa',
    headers: _session.authenticationHeaders,
    jsonBody: {
      'code': totp,
      'activeMfaType': 'totp',
    },
  );
}