Interface TOTPAuthenticator
- All Known Implementing Classes:
GoogleTOTPAuthenticator
public interface TOTPAuthenticator
Interface to a TOTP implementation's primitives.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface to a TOTP credential. -
Method Summary
Modifier and TypeMethodDescriptioncreateCredential(String issuer, String accountName) Generate a new credential.booleanvalidate(byte[] secret, int code) Validate a secret and code.
-
Method Details
-
createCredential
@Nonnull TOTPAuthenticator.TOTPCredential createCredential(@Nullable @NotEmpty String issuer, @Nullable @NotEmpty String accountName) throws GeneralSecurityException Generate a new credential.- Parameters:
issuer- TOTP credential issueraccountName- TOTP account holder- Returns:
- a new credential
- Throws:
GeneralSecurityException- if unable to generate the credential
-
validate
Validate a secret and code.- Parameters:
secret- token secret/seed, unencodedcode- token code to validate- Returns:
- true iff the code is valid
-