Nevis Mobile Authentication SDK React Native plugin
    Preparing search index...

    Class PasswordPolicyAbstract

    The object defining whether the password provided by a user during enrollment or when changing is valid.

    Index

    Methods

    • Performs validation of the password for enrollment during a registration.

      If validation fails, the implementation must invoke the provided onError with the error. The error will be the one returned by the PasswordEnrollmentContext.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 password to have at least 8 different characters:

       validatePasswordForEnrollment(
      _password: string,
      onSuccess: () => void,
      _onError: (error: PasswordEnrollmentCustomValidationError) => void
      ): void {
      if(isAtLeast8CharacterLong(password)) {
      const error = new PasswordEnrollmentCustomValidationError(
      "The password has less than 8 characters."
      );
      onError(error);
      } else {
      onSuccess();
      }
      }

      Parameters

      • password: string

        the password to be validated.

      • onSuccess: () => void

        the callback to invoke if the validation is successful.

      • onError: (error: PasswordEnrollmentCustomValidationError) => void

        the callback to invoke with error if the validation fails.

      Returns void

    • Performs validation of the password during a PasswordChange operation.

      If validation fails, the implementation must invoke the provided onError with the error. The error will be the one returned by the PasswordChangeContext.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 password to be the same as a confirmation password provided in another field:

       validatePasswordForPasswordChange(
      _password: string,
      onSuccess: () => void,
      _onError: (error: PasswordChangeRecoverableCustomValidationError) => void
      ): void {
      if(isAtLeast8CharacterLong(password)) {
      const error = new PasswordChangeRecoverableCustomValidationError(
      "The password has less than 8 characters."
      );
      onError(error);
      } else {
      onSuccess();
      }
      }

      Parameters

      • password: string

        the password to be validated.

      • onSuccess: () => void

        the callback to invoke if the validation is successful.

      • onError: (error: PasswordChangeRecoverableCustomValidationError) => void

        the callback to invoke with error if the validation fails.

      Returns void