Fix: Parsing of account name

This commit is contained in:
Neeraj Gupta
2023-04-03 12:13:43 +05:30
parent d1e1cb983e
commit 1c3ebd026b

View File

@@ -68,6 +68,11 @@ class Code {
static String _getAccount(Uri uri) {
try {
final String path = Uri.decodeComponent(uri.path);
// Parse account name from documented auth URI
// otpauth://totp/ACCOUNT?secret=SUPERSECRET&issuer=SERVICE
if (uri.queryParameters.containsKey("issuer") && !path.contains(":")) {
return path;
}
return path.split(':')[1];
} catch (e) {
return "";