What is @zxcvbn-ts/core?
@zxcvbn-ts/core is a TypeScript implementation of the popular zxcvbn password strength estimator. It provides a way to evaluate the strength of passwords and offers feedback on how to improve them. This package is useful for enhancing security by ensuring users create strong passwords.
What are @zxcvbn-ts/core's main functionalities?
Password Strength Estimation
This feature allows you to estimate the strength of a given password. The result includes a score and feedback on how to improve the password.
const zxcvbn = require('@zxcvbn-ts/core');
const result = zxcvbn('password123');
console.log(result);
Feedback on Password
This feature provides feedback on the given password, suggesting ways to make it stronger.
const zxcvbn = require('@zxcvbn-ts/core');
const result = zxcvbn('password123');
console.log(result.feedback);
Password Strength Score
This feature returns a score between 0 and 4 indicating the strength of the password, with 0 being very weak and 4 being very strong.
const zxcvbn = require('@zxcvbn-ts/core');
const result = zxcvbn('password123');
console.log(result.score);
Other packages similar to @zxcvbn-ts/core
zxcvbn
zxcvbn is the original password strength estimator developed by Dropbox. It is written in JavaScript and provides similar functionality to @zxcvbn-ts/core, including password strength estimation and feedback. However, it is not written in TypeScript, which may be a consideration for TypeScript projects.
owasp-password-strength-test
owasp-password-strength-test is a password strength tester that follows the guidelines provided by the OWASP (Open Web Application Security Project). It provides a different approach to password strength estimation compared to @zxcvbn-ts/core, focusing on compliance with OWASP standards.
password-validator
password-validator is a simple and flexible password validation library. It allows you to define custom rules for password strength, which can be more flexible than the predefined rules in @zxcvbn-ts/core. However, it does not provide the same level of detailed feedback and scoring.
zxcvbn-ts
zxcvbn is a password strength estimator inspired by password crackers.
It recognizes and analyzes over 40 thousand common passwords using pattern matching and conservative estimation and
filters out common first names, last names, popular words from Wikipedia and common words in many cultures,
and recognizes common patterns like dates, repetitions (e.g. 'aaa'), sequences (e.g. 'abcd'), keyboard smashes (e.g. 'qwertyuiop'), and l33t speak.
Installation
npm:
npm install @zxcvbn-ts/core @zxcvbn-ts/language-common --save
yarn:
yarn add @zxcvbn-ts/core @zxcvbn-ts/language-common
Setup
import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core'
import * as zxcvbnCommonPackage from '@zxcvbn-ts/language-common'
import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en'
const password = 'somePassword'
const options = {
dictionary: {
...zxcvbnCommonPackage.dictionary,
...zxcvbnEnPackage.dictionary,
},
graphs: zxcvbnCommonPackage.adjacencyGraphs,
translations: zxcvbnEnPackage.translations,
}
zxcvbnOptions.setOptions(options)
zxcvbn(password)