mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-15 06:22:49 +00:00
parent
1dd5f893da
commit
118221e3df
1 changed files with 13 additions and 6 deletions
|
@ -14,6 +14,7 @@ import com.beemdevelopment.aegis.encoding.Base32Exception;
|
||||||
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;
|
||||||
|
import com.beemdevelopment.aegis.otp.SteamInfo;
|
||||||
import com.beemdevelopment.aegis.otp.TotpInfo;
|
import com.beemdevelopment.aegis.otp.TotpInfo;
|
||||||
import com.beemdevelopment.aegis.util.ByteInputStream;
|
import com.beemdevelopment.aegis.util.ByteInputStream;
|
||||||
|
|
||||||
|
@ -60,12 +61,18 @@ public class AndOtpFileImporter extends DatabaseFileImporter {
|
||||||
byte[] secret = Base32.decode(obj.getString("secret").toCharArray());
|
byte[] secret = Base32.decode(obj.getString("secret").toCharArray());
|
||||||
|
|
||||||
OtpInfo info;
|
OtpInfo info;
|
||||||
if (type.equals("totp")) {
|
switch (type) {
|
||||||
info = new TotpInfo(secret, algo, digits, obj.getInt("period"));
|
case "hotp":
|
||||||
} else if (type.equals("hotp")) {
|
info = new HotpInfo(secret, algo, digits, obj.getLong("counter"));
|
||||||
info = new HotpInfo(secret, algo, digits, obj.getLong("counter"));
|
break;
|
||||||
} else {
|
case "totp":
|
||||||
throw new DatabaseImporterException("unsupported otp type: " + type);
|
info = new TotpInfo(secret, algo, digits, obj.getInt("period"));
|
||||||
|
break;
|
||||||
|
case "steam":
|
||||||
|
info = new SteamInfo(secret, algo, digits, obj.getInt("period"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new DatabaseImporterException("unsupported otp type: " + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue