Voipex passwpord policy is library consist from another libraries which were put to getter to make one complex library handeling password policies.
Set default policy used by IPEX a.s.
policy.defaultPolicy = 'sip'
- policy
- default value: not set
- allowed value - ['sip', 'users']
Minimal length of password to be valid. If value is 0 validator is not applied
- minimumLength
- default value: 0
- when value is 0 validator is not used
policy.minimumLength = 1
Maximal length of password to be valid. Default = 0 validotor is not used
- maximumLength
- default value: 0
- when value is 0 validator is not used
policy.maximumLength = 1
Set of uppers letters which password can only contain.
- upperLetters
- default value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
policy.allowedUpperLetter = 'A'
Set of lower letters which password can only contain
- lowerLetters
- default value: 'abcdefghijklmnopqrstuvwxyz'
policy.allowedLowerLetter = 'a'
Set of digits which password can only contain.
- numbers
- default value: '0123456789'
policy.alloweNumbers = '0'
Set of symbols which password can only contain
- symbols -
- default value: '_-!"?$%^&*()+={}[]:;@'~#|<>,.?\/ '
policy.alloweSymbols = '-'
Minimal time for which password could't be cracked
- days
- default value: 0
- when value is 0 validator is not used
policy.minimumTimeToCrack = 1
Minimal count of upper letters in password to be valid
- numberOfUpperLetters
- default value: 0
- when value is 0 validator is not used
policy.minimumNumberOfUpperLetters = 1
Minimal count of digits in password to be valid
- numberOfDigits
- default value: 0
- when value is 0 validator is not used
policy.minimumNumberOfDigits = 1
Return list of errors in validators
console.log(policy.errors)
Check if password contains only allowed symbols
- active
- default value: false
Check if password contains only allowed letters
- active
- default value: false
Check if password contains only allowed digits
- active
- default value: false
Validate given password on setted rules
- password
const PasswordPolicy = require('voipex-password-policy')
const policy = new PasswordPolicy()
policy.defaultPolicy = 'user'
policy.validate('password')