|
4 | 4 |
|
5 | 5 | import com.beemdevelopment.aegis.R; |
6 | 6 | import com.beemdevelopment.aegis.crypto.CryptoUtils; |
7 | | -import com.beemdevelopment.aegis.encoding.Base32; |
8 | 7 | import com.beemdevelopment.aegis.encoding.Base64; |
9 | 8 | import com.beemdevelopment.aegis.encoding.EncodingException; |
| 9 | +import com.beemdevelopment.aegis.otp.GoogleAuthInfo; |
10 | 10 | import com.beemdevelopment.aegis.otp.HotpInfo; |
11 | 11 | import com.beemdevelopment.aegis.otp.OtpInfo; |
12 | 12 | import com.beemdevelopment.aegis.otp.OtpInfoException; |
|
16 | 16 | import com.beemdevelopment.aegis.util.IOUtils; |
17 | 17 | import com.beemdevelopment.aegis.util.JsonUtils; |
18 | 18 | import com.beemdevelopment.aegis.vault.VaultEntry; |
| 19 | +import com.google.common.base.Strings; |
19 | 20 | import com.topjohnwu.superuser.io.SuFile; |
20 | 21 |
|
21 | 22 | import org.json.JSONArray; |
@@ -173,9 +174,12 @@ public Result convert() { |
173 | 174 |
|
174 | 175 | private static VaultEntry convertEntry(JSONObject obj) throws DatabaseImporterEntryException { |
175 | 176 | try { |
176 | | - byte[] secret = Base32.decode(obj.getString("secret")); |
| 177 | + byte[] secret = GoogleAuthInfo.parseSecret(obj.getString("secret")); |
177 | 178 | JSONObject info = obj.getJSONObject("otp"); |
178 | | - String issuer = info.optString("issuer"); |
| 179 | + String issuer = obj.optString("name"); |
| 180 | + if (Strings.isNullOrEmpty(issuer)) { |
| 181 | + issuer = info.optString("issuer"); |
| 182 | + } |
179 | 183 | String name = info.optString("account"); |
180 | 184 | int digits = info.optInt("digits", TotpInfo.DEFAULT_DIGITS); |
181 | 185 | String algorithm = info.optString("algorithm", TotpInfo.DEFAULT_ALGORITHM); |
|
0 commit comments