Add check if OTP secrets length is 0 and updated docs
This commit is contained in:
parent
6f3e7f1f5f
commit
a2af6825f0
@ -45,7 +45,7 @@ public abstract class OTP {
|
|||||||
* @param counter REQUIRED if HOTP, otherwise meaningless. The initial counter for HOTP (eg 21, if user reloaded counter 21 times)
|
* @param counter REQUIRED if HOTP, otherwise meaningless. The initial counter for HOTP (eg 21, if user reloaded counter 21 times)
|
||||||
* @param periodInSeconds OPTIONAL (default 30) for TOTP, the refresh rate of the TOTP
|
* @param periodInSeconds OPTIONAL (default 30) for TOTP, the refresh rate of the TOTP
|
||||||
* @param checksum OPTIONAL: appends a checksum digit to the end of the string
|
* @param checksum OPTIONAL: appends a checksum digit to the end of the string
|
||||||
* @return returns your wallet to the lost-and-found office
|
* @return returns a valid OTP object or null, which can be used to create a new OTP pin
|
||||||
*/
|
*/
|
||||||
public static OTP createNewOTP(OTPType type, String secret, OTPAlgorithm algorithm, int digits, long counter, long periodInSeconds, boolean checksum) throws OTPException{
|
public static OTP createNewOTP(OTPType type, String secret, OTPAlgorithm algorithm, int digits, long counter, long periodInSeconds, boolean checksum) throws OTPException{
|
||||||
if(type == null) return null;
|
if(type == null) return null;
|
||||||
|
@ -17,7 +17,7 @@ public enum OTPType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public OTP instance(String secret, OTPAlgorithm algorithm, int digits, long counter, long periodInSeconds, boolean checksum) {
|
public OTP instance(String secret, OTPAlgorithm algorithm, int digits, long counter, long periodInSeconds, boolean checksum) {
|
||||||
if(/*type == null ||*/ secret == null /*|| counter < 0*/) {
|
if(/*type == null ||*/ secret == null || secret.length() == 0/*|| counter < 0*/) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user