Interface PinEnroller

All Superinterfaces:
PinPolicyProvider

public interface PinEnroller extends PinPolicyProvider
The object in charge of PIN enrollment. It must be implemented by the developer of the SDK.
  private void pinEnroller() {
      PinEnroller pinEnroller = new PinEnroller() {
          @Override
          public void enrollPin(PinEnrollmentContext context, PinEnrollmentHandler handler) {
              if (context.lastRecoverableError().isPresent()) {
                  // Display error informing that the previously provided PIN did not have
                  // valid syntax.
              }
              askUserForPin(handler);
          }

          @Override
          public PinPolicy pinPolicy() {
              return PinPolicy.builder()
                  .minLength(6)
                  .maxLength(6)
                  .build();
          }
      };
 }

 /**
   Asks the user to provide the new PIN. If the user cancels the operation,
   invokes {@code PinEnrollmentHandler#cancel}. If the user provides a PIN,
   invokes {@code PinEnrollmentHandler#pin}
 /
 private void askUserForPin(PinEnrollmentHandler handler) {
      //
 }
 
See Also:
  • Method Details

    • enrollPin

      void enrollPin(PinEnrollmentContext context, PinEnrollmentHandler handler)
      The method that will be invoked till either the user provides a PIN that is conform with the format specified by the PinPolicy or till the operation is canceled (through the PinEnrollmentHandler.cancel().
      Parameters:
      context - the context
      handler - the object that must be invoked with the new PIN
    • pinPolicy

      default PinPolicy pinPolicy()
      Returns the object defining the constraints of the PIN to be enrolled. If not implemented, it will return a PIN policy with a minimum and maximum length of 6 digits.
      Specified by:
      pinPolicy in interface PinPolicyProvider
      Returns:
      the PinPolicy
    • onValidCredentialsProvided

      void onValidCredentialsProvided()
      This method is invoked when valid PIN credentials were provided during registration.

      This method can be used for instance to hide the UI used to ask for credentials to the user (some text fields to get PIN credentials) and then display some progress message indicating that the registration is ongoing.

      Note that invoking this method does not mean that the registration completed successfully (this is notified through methods such as Registration.onSuccess(Runnable) once the FIDO UAF server validates the request generated with the credentials).