Make subclasses of TotpInfo override only getOtp(long time)

This fixes an issue where Steam OTP's were displayed in the wrong
format. The underlying issue has been present for a while, but it first
became apparent in e4c9a584f4.
This commit is contained in:
Alexander Bakker 2024-11-17 10:39:33 +01:00
parent 6d8eec0e21
commit 843e5f1ab5
6 changed files with 9 additions and 30 deletions

View file

@ -30,20 +30,6 @@ public class MotpInfo extends TotpInfo {
setPin(pin);
}
@Override
public String getOtp() {
if (_pin == null) {
throw new IllegalStateException("PIN must be set before generating an OTP");
}
try {
MOTP otp = MOTP.generateOTP(getSecret(), getAlgorithm(false), getDigits(), getPeriod(), getPin());
return otp.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
@Override
public String getOtp(long time) {
if (_pin == null) {