From bb57b184498cfb811fe1aa235387cc3bab7506af Mon Sep 17 00:00:00 2001 From: Jakob Nixdorf Date: Sat, 18 Apr 2020 11:33:35 +0200 Subject: [PATCH] Support Steam URIs Closes #510 --- .../java/org/shadowice/flocke/andotp/Database/Entry.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Database/Entry.java b/app/src/main/java/org/shadowice/flocke/andotp/Database/Entry.java index c0670461..e407d11d 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Database/Entry.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Database/Entry.java @@ -122,6 +122,8 @@ public class Entry { type = OTPType.TOTP; } else if (url.getHost().equals("hotp")) { type = OTPType.HOTP; + } else if (url.getHost().equals("steam")) { + type = OTPType.STEAM; } else { throw new Exception("unknown otp type"); } @@ -142,7 +144,7 @@ public class Entry { } else { throw new Exception("missing counter for HOTP"); } - } else if (type == OTPType.TOTP) { + } else if (type == OTPType.TOTP || type == OTPType.STEAM) { if (period != null) { this.period = Integer.parseInt(period); } else { @@ -157,7 +159,7 @@ public class Entry { if (digits != null) { this.digits = Integer.parseInt(digits); } else { - this.digits = TokenCalculator.TOTP_DEFAULT_DIGITS; + this.digits = this.type == OTPType.STEAM ? TokenCalculator.STEAM_DEFAULT_DIGITS : TokenCalculator.TOTP_DEFAULT_DIGITS; } if (algorithm != null) {