Add support for otpauth://steam URI's

Close #343
This commit is contained in:
Alexander Bakker 2020-04-18 12:22:57 +02:00
parent 866466d158
commit 0c7b41747e

View file

@ -25,7 +25,11 @@ public class GoogleAuthInfo {
builder.scheme("otpauth");
if (_info instanceof TotpInfo) {
builder.authority("totp");
if (_info instanceof SteamInfo) {
builder.authority("steam");
} else {
builder.authority("totp");
}
builder.appendQueryParameter("period", Integer.toString(((TotpInfo)_info).getPeriod()));
} else if (_info instanceof HotpInfo) {
builder.authority("hotp");
@ -89,6 +93,14 @@ public class GoogleAuthInfo {
}
info = totpInfo;
break;
case "steam":
SteamInfo steamInfo = new SteamInfo(secret);
period = uri.getQueryParameter("period");
if (period != null) {
steamInfo.setPeriod(Integer.parseInt(period));
}
info = steamInfo;
break;
case "hotp":
HotpInfo hotpInfo = new HotpInfo(secret);
String counter = uri.getQueryParameter("counter");