setupTOTP method
Sets up TOTP for the logged in user
Implementation
Future<void> setupTOTP({String? appName}) async {
emit(state.startLoading(totpSetupLoading));
try {
final (totpSecret, totpUri) = await provider.setupTOTP(
appName: appName,
);
emit(state.copyWith(
totpSetupSecret: totpSecret,
totpSetupUri: totpUri,
));
} on TOTPSetupException catch (error, stackTrace) {
emit(state.addMessage(
Message.error(
_localizations.totpSetupError(error.message),
),
error,
stackTrace,
));
} finally {
emit(state.endLoading(totpSetupLoading));
}
}