Skip to content

#8 new kith() with options

Axorax edited this page Apr 14, 2023 · 1 revision

• Common list

Allows you to provide a list of common passwords that will automatically get rejected (will return rejected as true) when tested.

You must provide an array and it is case-sensitive.

This command list applies to all password test's by default.

const pass = new kith({
    common: [
        "xyz",
        "123"
    ]
});

• Change minimum length of password

const pass = new kith({
    length: 12
});

• Add reject score

If the score is less than a certain amount then it will return rejected as true

const pass = new kith({
    rejectScore: 5 // score < 5
});

• Change checks entirely

const pass = new kith({
    checks: {
        "hasNumbers": {
            "score": 69, // score if "hasNumbers" is true
            "code": "[0-9]" // regex
        }
    }
});

Invert the boolean

const pass = new kith({
    checks: {
        "hasNumbers": {
            "score": 69,
            "code": "[0-9]",
            "invert": true
        }
    }
});

This will make the score increase if code is false and do nothing if the code is true.

It is helpful for checking something like whether the password has repeated characters or not.