Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 920 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 920 Bytes

UITextInputPasswordRules Descriptor Generator

A simple utility for generating the descriptor to initialize a UITextInputPasswordRules object per Apple's Customizing Password AutoFill rules documentation.

Maintained by Parra

Installation

Run npm install @parra/ios-password-rules-descriptor

Usage

const generatePasswordRulesDescriptor = require("@parra/ios-password-rules-descriptor")

const rules = [
  { required: 'upper' },
  { required: 'lower' },
  { required: 'digit' },
  { allowed: '[-().&@?\'#,/"+]' },
  { maxConsecutive: 2 },
  { minLength: 8 },
  { maxLength: 128 }
];

const descriptor = generatePasswordRulesDescriptor(rules);

// required: upper, lower, digit; allowed: [-().&@?\'#,/"+]; max-consecutive: 2; minlength: 8; maxlength: 128;