zxcvbn icon indicating copy to clipboard operation
zxcvbn copied to clipboard

"Matcher pwned already exists" warning message issue

Open U-4-E-A opened this issue 4 months ago • 1 comments

v3.0.4

When I use the following config, I get the warning "Matcher pwned already exists". I still works as expected, just not sure why I am getting this message?

export const configureZXCVBN = async (): Promise<void> => {
  const zxcvbnCommonPackage = await import('@zxcvbn-ts/language-common')

  const zxcvbnEnPackage = await import('@zxcvbn-ts/language-en')

  const options: Pick<Partial<typeof zxcvbnOptions>, 'dictionary' | 'graphs' | 'translations'> = {
    dictionary: {
      ...zxcvbnCommonPackage.dictionary,
      ...zxcvbnEnPackage.dictionary
    },
    graphs: zxcvbnCommonPackage.adjacencyGraphs,
    translations: {
      ...zxcvbnEnPackage.translations
    }
  }

  const matcherPwned = matcherPwnedFactory(fetch, zxcvbnOptions)

  zxcvbnOptions.addMatcher('pwned', matcherPwned)
  zxcvbnOptions.setOptions(options)
}

U-4-E-A avatar Feb 27 '24 19:02 U-4-E-A

It just tells you that you add the matcher multiple times and probably triggering the options multiple times which if triggered to often in a short amount of time is bad.

But this issue should be gone in 4.0.0 as zxcvbn will be class which can be initalized with a fixed set of options

MrWook avatar May 17 '24 12:05 MrWook