Members
(constant) validate :Validator
Type:
Methods
createTweakedValidator(options) → {Validator}
- Source:
Creates tweaked validator.
Parameters:
Name | Type | Description |
---|---|---|
options |
TweakedOptions |
Returns:
- validator function
- Type
- Validator
createValidator(fullPoints, requiredPercentage, pointsPerChar, pointsPerUnique, repeatedCharPenalty, repeatedCharCount, repeatedCharMaxPosition, minUniqueChars, maxNonUniqueScore) → {Validator}
Creates new validator with some rules overriden. Use `tweaked.js` export to more friendly configuration (object with
defaults, instead of long list of required arguments)
Parameters:
Name | Type | Description |
---|---|---|
fullPoints |
number | points required to score for value to be marked as "100% secure" |
requiredPercentage |
number | percentage value required for password to be considered safe |
pointsPerChar |
number | how many points are added per character |
pointsPerUnique |
number | how many additional points are added per unique character |
repeatedCharPenalty |
number | how many points are taken for repeated characters |
repeatedCharCount |
number | how many times a character should be repeated before being considered "repeated" |
repeatedCharMaxPosition |
number | position in string after characters are no longer considered repeated (this is used to avoid longer passwords to be considered less and less secure, because user run out of unique characters on keyboard) |
minUniqueChars |
number | minimal count of unique characters required to not lowering the points to `maxNonUniqueScore` value |
maxNonUniqueScore |
number | if minimal count of unique characters is not met - this is the point to the score will be lowered (only if already higher) |
Returns:
- Type
- Validator
Type Definitions
Result
Properties:
Name | Type | Description |
---|---|---|
points |
number | scored points |
percentage |
number | percentage value of password security (0 - 100) |
valid |
boolean | is password score considered secure enough |
Type:
- Object
TweakedOptions
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fullPoints |
number |
<optional> |
18
|
points required to score for value to be marked as "100% secure" |
requiredPercentage |
number |
<optional> |
75
|
percentage value required for password to be considered safe |
pointsPerChar |
number |
<optional> |
1
|
how many points are added per character |
pointsPerUnique |
number |
<optional> |
0.5
|
how many additional points are added per unique character |
repeatedCharPenalty |
number |
<optional> |
1.5
|
how many points are taken for repeated characters |
repeatedCharCount |
number |
<optional> |
3
|
how many times a character should be repeated before being considered "repeated" |
repeatedCharMaxPosition |
number |
<optional> |
7
|
position in string after characters are no longer considered repeated (this is used to avoid longer passwords to be considered less and less secure, because user run out of unique characters on keyboard) |
minUniqueChars |
number |
<optional> |
5
|
minimal count of unique characters required to not lowering the points to `maxNonUniqueScore` value |
maxNonUniqueScore |
number |
<optional> |
5
|
if minimal count of unique characters is not met - this is the point to the score will be lowered (only if already higher) |
Type:
- Object
Validator(value) → {Result}
Parameters:
Name | Type | Description |
---|---|---|
value |
string | password to measure its security level |
Returns:
- Type
- Result