The object defining the minimum and maximum length of the PIN.

Hierarchy

  • PinPolicy

Properties

minLength: number

The minimum length of the PIN.

maxLength: number

The maximum length of the PIN.

Methods

  • Default constructor for PinPolicy.

    Parameters

    • minLength: number

      the minimum length of the PIN.

    • maxLength: number

      the maximum length of the PIN.

    Returns PinPolicy

    an PinPolicy instance.

  • Performs validation other than the minimum and maximum PIN length during PIN enrollment.

    This must be implemented in the case you require additional criteria for a PIN to be valid: the PIN must contain a minimum number of distinct digits, sequences of consecutive digits are disallowed, etc.

    If this method is not implemented, only the PIN minimum and maximum length will be validated during PIN enrollment.

    If validation fails, the implementation must invoke the provided onError with the error. The error will be the one returned by the PinEnrollmentContext.lastRecoverableError property.

    The implementation must guarantee that, one (and only one) of onSuccess and onError is invoked, and that the one invoked is invoked only once.

    Synchronous implementation example that requires PIN to have at least 4 different digits:

     validatePinForEnrollment(
    _pin: string,
    onSuccess: () => void,
    _onError: (error: PinEnrollmentCustomValidationError) => void
    ): void {
    if(hasLessThan4DifferentDigits(pin)) {
    const error = new PinEnrollmentCustomValidationError(
    "The PIN has less than 4 consecutive digits."
    );
    onError(error);
    } else {
    onSuccess();
    }
    }

    Parameters

    • pin: string

      the PIN to be validated.

    • onSuccess: (() => void)

      the callback to invoke if the validation is successful.

        • (): void
        • Returns void

    • onError: ((error) => void)

      the callback to invoke with error if the validation fails.

    Returns void

  • Performs validation other than the minimum and maximum PIN length during PIN change.

    This must be implemented in the case you require additional criteria for a PIN to be valid: the PIN must contain a minimum number of distinct digits, sequences of consecutive digits are disallowed, etc.

    If this method is not implemented, only the PIN minimum and maximum length will be validated during PIN enrollment.

    If validation fails, the implementation must invoke the provided onError with the error. The error will be the one returned by the PinEnrollmentContext.lastRecoverableError property.

    The implementation must guarantee that, one (and only one) of onSuccess and onError is invoked, and that the one invoked is invoked only once.

    Synchronous implementation example that requires the PIN to be the same as a confirmation PIN provided in another field:

     validatePinForPinChange(
    _pin: string,
    onSuccess: () => void,
    _onError: (error: PinChangeRecoverableCustomValidationError) => void
    ): void {
    if(isDifferentThanConfirmationPIN(pin)) {
    const error = new PinChangeRecoverableCustomValidationError(
    "The provided PINs do not match."
    );
    onError(error);
    } else {
    onSuccess();
    }
    }

    Parameters

    • pin: string

      the PIN to be validated.

    • onSuccess: (() => void)

      the callback to invoke if the validation is successful.

        • (): void
        • Returns void

    • onError: ((error) => void)

      the callback to invoke with error if the validation fails.

    Returns void

Generated using TypeDoc