Completed: Import from bitwarden functionality

This commit is contained in:
Muhammed Ayimen 2023-11-14 22:38:55 +09:00
parent bed3bd9612
commit 9b759a02a5

View file

@ -93,19 +93,13 @@ Future<int?> _processBitwardenExportFile(
var account = item['login']['username']; var account = item['login']['username'];
var secret = item['login']['totp']; var secret = item['login']['totp'];
// Build the OTP URL parsedCodes.add(
String otpUrl; Code.fromAccountAndSecret(
account,
if (kind.toLowerCase() == 'totp') { issuer,
otpUrl = secret,
'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));
} }
} }