TGFPasscodeRuleLength

Objective-C


@interface TGFPasscodeRuleLength : TGFPasscodeRule

Swift

class TGFPasscodeRuleLength : TGFPasscodeRule

A concrete passcode rule that validates whether a passcode’s length falls within a globally configured range.

This rule enforces minimum and maximum length requirements for user passcodes. The length constraints are configured globally using the class methods provided. If a passcode’s length is outside the minimumLength and maximumLength bounds, validation will fail with a relevant NSError.

This class is a subclass of TGFPasscodeRule and is used to enforce a passcode policy.

@since 1.3.0

  • Returns the default minimum required passcode length.

    Declaration

    Objective-C

    + (NSUInteger)defaultMinimumLength;

    Swift

    class func defaultMinimumLength() -> UInt

    Return Value

    The default minimum length, which is 6.

  • Returns the default maximum allowed passcode length.

    Declaration

    Objective-C

    + (NSUInteger)defaultMaximumLength;

    Swift

    class func defaultMaximumLength() -> UInt

    Return Value

    The default maximum length, which is 8.

  • Returns the currently configured minimum required passcode length.

    If no value has been set, this will return the defaultMinimumLength.

    Declaration

    Objective-C

    + (NSUInteger)minimumLength;

    Swift

    class func minimumLength() -> UInt

    Return Value

    The current minimum length.

  • Configures the global minimum required passcode length.

    The length must be between 4 and the current maximumLength, inclusive. If the provided length is invalid, the current value is retained.

    Declaration

    Objective-C

    + (BOOL)setMinimumLength:(NSUInteger)length;

    Swift

    class func setMinimum(_ length: UInt) -> Bool

    Parameters

    length

    The new minimum length for passcodes.

    Return Value

    YES if the length was updated successfully; NO otherwise.

  • Returns the currently configured maximum allowed passcode length.

    If no value has been set, this will return the defaultMaximumLength.

    Declaration

    Objective-C

    + (NSUInteger)maximumLength;

    Swift

    class func maximumLength() -> UInt

    Return Value

    The current maximum length.

  • Configures the global maximum allowed passcode length.

    The length must be between the current minimumLength and 16, inclusive. If the provided length is invalid, the current value is retained.

    Declaration

    Objective-C

    + (BOOL)setMaximumLength:(NSUInteger)length;

    Swift

    class func setMaximum(_ length: UInt) -> Bool

    Parameters

    length

    The new maximum length for passcodes.

    Return Value

    YES if the length was updated successfully; NO otherwise.