Merge pull request #366 from alexbakker/steam-otpauth

Add support for otpauth://steam URI's
This commit is contained in:
Michael Schättgen 2020-04-18 14:06:36 +02:00 committed by GitHub
commit 8c0ba2dd1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,11 @@ public class GoogleAuthInfo {
builder.scheme("otpauth");
if (_info instanceof TotpInfo) {
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");