Interface OneTimeCodeGenerator


public interface OneTimeCodeGenerator
Port that generates the numeric codes users type.
  • Method Summary

    Modifier and Type
    Method
    Description
    generate(int digits)
    Generates a random numeric code from a cryptographically secure source.
  • Method Details

    • generate

      String generate(int digits)
      Generates a random numeric code from a cryptographically secure source.
      Parameters:
      digits - number of digits, at least one.
      Returns:
      the code, left-padded with zeros to exactly digits characters.
      Throws:
      IllegalArgumentException - if digits is not positive.