/** * The private constructor of this class. * * @param config the configuration of the TOTP algorithm. * @param key the secret key in Base32 encoding. * @param verificationCode the verification code at time = 0 (the UNIX epoch). * @param scratchCodes the list of scratch codes. */ private AuthenticatorKey(AuthenticatorConfig _config, String _key, int _verificationCode, List <int> _scratchCodes) { if (key == null) { // throw new IllegalArgumentException("Key cannot be null"); } if (config == null) { //throw new IllegalArgumentException("Configuration cannot be null"); } if (scratchCodes == null) { //throw new IllegalArgumentException("Scratch codes cannot be null"); } config = _config; key = _key; verificationCode = _verificationCode; scratchCodes = new List <int>(_scratchCodes); }
public Authenticator(AuthenticatorConfig config) { if (config == null) { //throw new IllegalArgumentException("Configuration cannot be null."); } this.config = config; }
/** * Sets the config of the TOTP algorithm for this key. * * @param config the config of the TOTP algorithm for this key. * @see AuthenticatorKey#AuthenticatorKey(AuthenticatorConfig, String, int, List) */ public Builder setConfig(AuthenticatorConfig config) { this.config = config; return(this); }
public Authenticator() { config = new AuthenticatorConfig(); }