diff --git a/frontend/package.json b/frontend/package.json index 07d90a51e..363ae52eb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,8 +26,8 @@ "@tanstack/react-router": "^1.170.16", "@vector-im/compound-design-tokens": "10.2.0", "@vector-im/compound-web": "^9.3.0", - "@zxcvbn-ts/core": "^3.0.4", - "@zxcvbn-ts/language-common": "^3.0.4", + "@zxcvbn-ts/core": "^4.1.2", + "@zxcvbn-ts/language-common": "^4.1.2", "classnames": "^2.5.1", "date-fns": "^4.4.0", "i18next": "^26.3.1", diff --git a/frontend/src/utils/password_complexity/index.ts b/frontend/src/utils/password_complexity/index.ts index 1cb25c60c..143c170c6 100644 --- a/frontend/src/utils/password_complexity/index.ts +++ b/frontend/src/utils/password_complexity/index.ts @@ -1,10 +1,11 @@ +// Copyright 2026 Element Creations Ltd. // Copyright 2024, 2025 New Vector Ltd. // Copyright 2024 The Matrix.org Foundation C.I.C. // // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial // Please see LICENSE files in the repository root for full details. -import { zxcvbnAsync, zxcvbnOptions } from "@zxcvbn-ts/core"; +import { ZxcvbnFactory } from "@zxcvbn-ts/core"; import * as zxcvbnCommonPackage from "@zxcvbn-ts/language-common"; import type { TFunction } from "i18next"; @@ -54,7 +55,7 @@ const options = { l33tTable, }; -zxcvbnOptions.setOptions(options); +const zxcvbn = new ZxcvbnFactory(options); export interface PasswordComplexity { /** Score between 0 and 4 */ @@ -72,7 +73,7 @@ export async function estimatePasswordComplexity( password: string, t: TFunction, ): Promise { - const scorerResult = await zxcvbnAsync(password); + const scorerResult = await zxcvbn.checkAsync(password); const improvementsText = []; if (scorerResult.feedback.warning !== null) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9d9911a47..4d8bd25d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,11 +51,11 @@ importers: specifier: ^9.3.0 version: 9.3.0(@fontsource/inconsolata@5.2.8)(@fontsource/inter@5.2.8)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(@vector-im/compound-design-tokens@10.2.0(@types/react@19.2.17)(react@19.2.7))(react-dom@19.2.7(react@19.2.7))(react@19.2.7) '@zxcvbn-ts/core': - specifier: ^3.0.4 - version: 3.0.4 + specifier: ^4.1.2 + version: 4.1.2 '@zxcvbn-ts/language-common': - specifier: ^3.0.4 - version: 3.0.4 + specifier: ^4.1.2 + version: 4.1.2 classnames: specifier: ^2.5.1 version: 2.5.1 @@ -2627,11 +2627,14 @@ packages: resolution: {integrity: sha512-Nst5JdK47VIl9UcGwtv2Rcgyn5lWtZ0/mhRQ4G8NN2isxpq2TO30iqHzmwoJycjWuyUfg3GFXqP/gFHXeV57IA==} engines: {node: '>=16.0.0'} - '@zxcvbn-ts/core@3.0.4': - resolution: {integrity: sha512-aQeiT0F09FuJaAqNrxynlAwZ2mW/1MdXakKWNmGM1Qp/VaY6CnB/GfnMS2T8gB2231Esp1/maCWd8vTG4OuShw==} + '@zxcvbn-ts/core@4.1.2': + resolution: {integrity: sha512-RQmxWB3AMI+HGQErQdUv6Aq32aQhp6xOxrfgCP0+T9MsLZoP3xtLHuT8O8VojsUxdmQVZfJlYkYb1A0wOwIS+Q==} - '@zxcvbn-ts/language-common@3.0.4': - resolution: {integrity: sha512-viSNNnRYtc7ULXzxrQIVUNwHAPSXRtoIwy/Tq4XQQdIknBzw4vz36lQLF6mvhMlTIlpjoN/Z1GFu/fwiAlUSsw==} + '@zxcvbn-ts/dictionary-compression@3.0.1': + resolution: {integrity: sha512-p3KyPzxGc3vWSap5hHA6SllbUCmh7s+NtpGyC3qEWrxYJT9t9TUAzjPm48Okipo+UUyPQfDlIvTcs9JRShBFiQ==} + + '@zxcvbn-ts/language-common@4.1.2': + resolution: {integrity: sha512-uJlBzhC9/KjPImqdnc1/lPxmdn4xKbkruN5p1mASWkXA0gli+GZ5LrVL+dqscA8Pcf4OfudE56TtCWeHljJOvA==} acorn@8.17.0: resolution: {integrity: sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==} @@ -6871,11 +6874,15 @@ snapshots: dependencies: tslib: 2.8.1 - '@zxcvbn-ts/core@3.0.4': + '@zxcvbn-ts/core@4.1.2': dependencies: fastest-levenshtein: 1.0.16 - '@zxcvbn-ts/language-common@3.0.4': {} + '@zxcvbn-ts/dictionary-compression@3.0.1': {} + + '@zxcvbn-ts/language-common@4.1.2': + dependencies: + '@zxcvbn-ts/dictionary-compression': 3.0.1 acorn@8.17.0: {}