Interface TOTPAuthenticator

All Known Implementing Classes:
GoogleTOTPAuthenticator

public interface TOTPAuthenticator
Interface to a TOTP implementation's primitives.
  • 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 issuer
      accountName - TOTP account holder
      Returns:
      a new credential
      Throws:
      GeneralSecurityException - if unable to generate the credential
    • validate

      boolean validate(@Nonnull @NotEmpty byte[] secret, int code)
      Validate a secret and code.
      Parameters:
      secret - token secret/seed, unencoded
      code - token code to validate
      Returns:
      true iff the code is valid