mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Abstract away otp refreshing
This commit is contained in:
parent
f09d227378
commit
754a42b2c0
4 changed files with 13 additions and 32 deletions
|
@ -1,7 +1,9 @@
|
|||
package me.impy.aegis;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
|
||||
import me.impy.aegis.crypto.otp.OTP;
|
||||
import me.impy.aegis.db.DatabaseEntry;
|
||||
|
||||
public class KeyProfile implements Serializable {
|
||||
|
@ -19,7 +21,12 @@ public class KeyProfile implements Serializable {
|
|||
return _code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
_code = code;
|
||||
public String refreshCode() {
|
||||
try {
|
||||
_code = OTP.generateOTP(_entry.getInfo());
|
||||
} catch (Exception e) {
|
||||
throw new UndeclaredThrowableException(e);
|
||||
}
|
||||
return _code;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue