diff --git a/lib/ui/settings/data/import/bitwarden_import.dart b/lib/ui/settings/data/import/bitwarden_import.dart index 7b14ceacc..fbf9ed16e 100644 --- a/lib/ui/settings/data/import/bitwarden_import.dart +++ b/lib/ui/settings/data/import/bitwarden_import.dart @@ -93,19 +93,13 @@ Future _processBitwardenExportFile( var account = item['login']['username']; var secret = item['login']['totp']; - // Build the OTP URL - String otpUrl; - - if (kind.toLowerCase() == 'totp') { - otpUrl = - 'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&period=$timer'; - } else if (kind.toLowerCase() == 'hotp') { - otpUrl = - 'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&counter=$counter'; - } else { - throw Exception('Invalid OTP type'); - } - parsedCodes.add(Code.fromRawData(otpUrl)); + parsedCodes.add( + Code.fromAccountAndSecret( + account, + issuer, + secret, + ), + ); } }