zxcvbn-ts / zxcvbn

Low-Budget Password Strength Estimation
https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/wheeler
MIT License
910 stars 72 forks source link

Change usage of library #244

Closed MrWook closed 9 months ago

MrWook commented 11 months ago

Closes: https://github.com/zxcvbn-ts/zxcvbn/issues/194

We move away from the painfull singleton usage to a class based approach to handle multiple options at the same time and make it less error prone it different setups. This way we get the setup like this:

import { ZxcvbnFactory } from '@zxcvbn-ts/core'
import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en'

const options = {
  translations: zxcvbnEnPackage.translations,
}
const zxcvbn = new ZxcvbnFactory(options)

const password = 'somePassword'
zxcvbn.check(password)