Merge pull request #338 from orangenbaumblatt/master

Keep groups when importing from Authenticator Plus
This commit is contained in:
Alexander Bakker 2020-03-20 16:23:53 +01:00 committed by GitHub
commit d89d5eac9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -101,7 +101,14 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
name = parts[1];
}
// Authenticator Plus saves all entries to the "All Accounts" category by default
// If an entry is in this category, we can consider it as uncategorized
String group = entry.getGroup();
if (group.equals("All Accounts")) {
return new VaultEntry(info, name, entry.getIssuer());
}
return new VaultEntry(info, name, entry.getIssuer(), entry.getGroup());
} catch (EncodingException | OtpInfoException | DatabaseImporterException e) {
throw new DatabaseImporterEntryException(e, entry.toString());
}
@ -129,6 +136,7 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
private String _secret;
private String _email;
private String _issuer;
private String _group;
private long _counter;
public Entry(Cursor cursor) {
@ -137,6 +145,7 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
_secret = SqlImporterHelper.getString(cursor, "secret");
_email = SqlImporterHelper.getString(cursor, "email", "");
_issuer = SqlImporterHelper.getString(cursor, "issuer", "");
_group = SqlImporterHelper.getString(cursor, "category", "");
_counter = SqlImporterHelper.getLong(cursor, "counter");
}
@ -156,6 +165,10 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
return _issuer;
}
public String getGroup() {
return _group;
}
public long getCounter() {
return _counter;
}

View file

@ -38,6 +38,13 @@ public class VaultEntry extends UUIDMap.Value {
setIssuer(issuer);
}
public VaultEntry(OtpInfo info, String name, String issuer, String group) {
this(info);
setName(name);
setIssuer(issuer);
setGroup(group);
}
public VaultEntry(GoogleAuthInfo info) {
this(info.getOtpInfo(), info.getAccountName(), info.getIssuer());
}