mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-19 13:29:13 +00:00
Merge pull request #1577 from alexbakker/2fas-fixes
Store service name as issuer and tolerate spaces in secret for 2FAS
This commit is contained in:
commit
920df1d9be
1 changed files with 7 additions and 3 deletions
|
@ -4,9 +4,9 @@ import android.content.Context;
|
||||||
|
|
||||||
import com.beemdevelopment.aegis.R;
|
import com.beemdevelopment.aegis.R;
|
||||||
import com.beemdevelopment.aegis.crypto.CryptoUtils;
|
import com.beemdevelopment.aegis.crypto.CryptoUtils;
|
||||||
import com.beemdevelopment.aegis.encoding.Base32;
|
|
||||||
import com.beemdevelopment.aegis.encoding.Base64;
|
import com.beemdevelopment.aegis.encoding.Base64;
|
||||||
import com.beemdevelopment.aegis.encoding.EncodingException;
|
import com.beemdevelopment.aegis.encoding.EncodingException;
|
||||||
|
import com.beemdevelopment.aegis.otp.GoogleAuthInfo;
|
||||||
import com.beemdevelopment.aegis.otp.HotpInfo;
|
import com.beemdevelopment.aegis.otp.HotpInfo;
|
||||||
import com.beemdevelopment.aegis.otp.OtpInfo;
|
import com.beemdevelopment.aegis.otp.OtpInfo;
|
||||||
import com.beemdevelopment.aegis.otp.OtpInfoException;
|
import com.beemdevelopment.aegis.otp.OtpInfoException;
|
||||||
|
@ -16,6 +16,7 @@ import com.beemdevelopment.aegis.ui.dialogs.Dialogs;
|
||||||
import com.beemdevelopment.aegis.util.IOUtils;
|
import com.beemdevelopment.aegis.util.IOUtils;
|
||||||
import com.beemdevelopment.aegis.util.JsonUtils;
|
import com.beemdevelopment.aegis.util.JsonUtils;
|
||||||
import com.beemdevelopment.aegis.vault.VaultEntry;
|
import com.beemdevelopment.aegis.vault.VaultEntry;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.topjohnwu.superuser.io.SuFile;
|
import com.topjohnwu.superuser.io.SuFile;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -173,9 +174,12 @@ public class TwoFASImporter extends DatabaseImporter {
|
||||||
|
|
||||||
private static VaultEntry convertEntry(JSONObject obj) throws DatabaseImporterEntryException {
|
private static VaultEntry convertEntry(JSONObject obj) throws DatabaseImporterEntryException {
|
||||||
try {
|
try {
|
||||||
byte[] secret = Base32.decode(obj.getString("secret"));
|
byte[] secret = GoogleAuthInfo.parseSecret(obj.getString("secret"));
|
||||||
JSONObject info = obj.getJSONObject("otp");
|
JSONObject info = obj.getJSONObject("otp");
|
||||||
String issuer = info.optString("issuer");
|
String issuer = obj.optString("name");
|
||||||
|
if (Strings.isNullOrEmpty(issuer)) {
|
||||||
|
issuer = info.optString("issuer");
|
||||||
|
}
|
||||||
String name = info.optString("account");
|
String name = info.optString("account");
|
||||||
int digits = info.optInt("digits", TotpInfo.DEFAULT_DIGITS);
|
int digits = info.optInt("digits", TotpInfo.DEFAULT_DIGITS);
|
||||||
String algorithm = info.optString("algorithm", TotpInfo.DEFAULT_ALGORITHM);
|
String algorithm = info.optString("algorithm", TotpInfo.DEFAULT_ALGORITHM);
|
||||||
|
|
Loading…
Add table
Reference in a new issue