Fix: Parsing of account name

This commit is contained in:
Neeraj Gupta 2023-04-03 12:13:43 +05:30
parent d1e1cb983e
commit 1c3ebd026b
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

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 "";