java.lang.Object
com.irurueta.authserver.authorization.domain.totp.TotpUri

public final class TotpUri extends Object
Builds the otpauth:// URI that authenticator applications read from a QR code to enrol a secret.
  • Constructor Details

    • TotpUri

      private TotpUri()
      Not instantiable: a holder of static helpers.
  • Method Details

    • build

      public static String build(String issuer, String account, byte[] secret)
      Builds the URI of a TOTP enrolment.
      Parameters:
      issuer - name of the service, shown by the authenticator.
      account - name of the account, shown by the authenticator.
      secret - the shared secret.
      Returns:
      the URI, with the parameters of TotpAlgorithm.
      Throws:
      IllegalArgumentException - if the issuer or the account is blank.
    • encode

      private static String encode(String value)
      Percent-encodes a value, with spaces as %20 as a URI path requires.
      Parameters:
      value - the value to encode.
      Returns:
      the encoded value.