2016-08-16 20:04:38 +02:00
|
|
|
package me.impy.aegis;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
2017-11-26 19:50:05 +01:00
|
|
|
import java.lang.reflect.UndeclaredThrowableException;
|
2016-08-16 20:04:38 +02:00
|
|
|
|
2017-11-26 19:50:05 +01:00
|
|
|
import me.impy.aegis.crypto.otp.OTP;
|
2017-08-26 21:15:53 +02:00
|
|
|
import me.impy.aegis.db.DatabaseEntry;
|
2016-08-16 20:04:38 +02:00
|
|
|
|
|
|
|
public class KeyProfile implements Serializable {
|
2017-08-26 21:15:53 +02:00
|
|
|
private String _code;
|
|
|
|
private DatabaseEntry _entry;
|
2016-10-25 23:53:33 +02:00
|
|
|
|
2017-08-26 21:15:53 +02:00
|
|
|
public KeyProfile(DatabaseEntry entry) {
|
|
|
|
_entry = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DatabaseEntry getEntry() {
|
|
|
|
return _entry;
|
|
|
|
}
|
|
|
|
public String getCode() {
|
|
|
|
return _code;
|
|
|
|
}
|
|
|
|
|
2017-11-26 19:50:05 +01:00
|
|
|
public String refreshCode() {
|
|
|
|
try {
|
|
|
|
_code = OTP.generateOTP(_entry.getInfo());
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new UndeclaredThrowableException(e);
|
|
|
|
}
|
|
|
|
return _code;
|
2016-10-25 23:53:33 +02:00
|
|
|
}
|
2016-08-16 20:04:38 +02:00
|
|
|
}
|