A simple utility for generating the descriptor
to initialize a UITextInputPasswordRules
object per Apple's Customizing Password AutoFill rules documentation.
Maintained by Parra
Run npm install @parra/ios-password-rules-descriptor
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;