{"id":24751990,"url":"https://github.com/deanilvincent/check-password-strength","last_synced_at":"2025-05-15T03:06:50.419Z","repository":{"id":42583497,"uuid":"235749779","full_name":"deanilvincent/check-password-strength","owner":"deanilvincent","description":"A simple npm package that checks the password strength of a certain passphrase. A password strength checker based from Javascript RegEx.","archived":false,"fork":false,"pushed_at":"2025-01-20T18:09:44.000Z","size":678,"stargazers_count":180,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-05T01:07:12.516Z","etag":null,"topics":["javascript-regex","npm","npm-package","passphrase","password-regex","password-strength","regex"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/check-password-strength","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deanilvincent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-23T08:04:58.000Z","updated_at":"2025-05-01T11:52:59.000Z","dependencies_parsed_at":"2024-06-18T13:35:22.470Z","dependency_job_id":"97b05a39-ebcf-42ff-a62c-38d9ab104711","html_url":"https://github.com/deanilvincent/check-password-strength","commit_stats":{"total_commits":99,"total_committers":11,"mean_commits":9.0,"dds":"0.38383838383838387","last_synced_commit":"b01538b0b67e94a0aa09ca4e02be3a938b75c504"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanilvincent%2Fcheck-password-strength","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanilvincent%2Fcheck-password-strength/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanilvincent%2Fcheck-password-strength/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanilvincent%2Fcheck-password-strength/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deanilvincent","download_url":"https://codeload.github.com/deanilvincent/check-password-strength/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264766,"owners_count":22041793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript-regex","npm","npm-package","passphrase","password-regex","password-strength","regex"],"created_at":"2025-01-28T10:26:33.101Z","updated_at":"2025-05-15T03:06:45.402Z","avatar_url":"https://github.com/deanilvincent.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Overview\n\nA simple way to check that password strength of a certain passphrase. The library is fully typed.\n\n[![Build status](https://dev.azure.com/dv-github-repos/check-password-strength/_apis/build/status/check-password-strength-CI)](https://dev.azure.com/dv-github-repos/check-password-strength/_build/latest?definitionId=12) \n\n[![npm](https://img.shields.io/npm/dm/check-password-strength.svg)](https://img.shields.io/npm/dm/check-password-strength.svg) [![Downloads](https://img.shields.io/npm/dt/check-password-strength.svg)](https://img.shields.io/npm/dt/check-password-strength.svg)\n\n[DEMO 1](https://svelte.dev/repl/b5bf5871c99742e584da244b4bfeac92?version=3.44.3) by [@Ennoriel](https://github.com/Ennoriel)\n\n[DEMO 2](https://check-password-strength.netlify.app/)\n\n## Installation\n\n### Install via Package Manager\n\n`npm i check-password-strength --save`\n\n### Install via Browser Script Tag using [UNPKG](https://unpkg.com/)\n\n```html\n\u003cscript src=\"https://unpkg.com/check-password-strength/dist/umd.cjs\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    const passwordStrength = checkPasswordStrength.passwordStrength('pwd123').value; // 'Weak'\n\u003c/script\u003e\n```\n\n## Setup \u0026 Basic Usage\n\n```javascript\nconst { passwordStrength } = require('check-password-strength')\n// OR\nimport { passwordStrength } from 'check-password-strength'\n\nconsole.log(passwordStrength('asdfasdf').value)\n// Too weak (It will return Too weak if the value doesn't match the Weak conditions)\n\nconsole.log(passwordStrength('asdf1234').value)\n// Weak\n\nconsole.log(passwordStrength('Asd1234!').value)\n// Medium\n\nconsole.log(passwordStrength('A@2asdF2020!!*').value)\n// Strong\n```\n\n## API\n\n### arguments\n\nThe `passwordStrength` takes 3 arguments:\n\n- `password` (string): the user password\n- `options` (array — optional): an option to override the default complexity required to match your password policy. See below.\n- `restrictSymbolsTo` (string — optional): \n  - By default, the `passwordStrength` function checks against all characters except for the 26 Latin lowercase letters, 26 uppercase letters, and 10 digits. This includes OWASP-recommended characters, accented letters, other alphabets, and emojis.\n  - If you wish to apply restrictions, you can provide a custom string. This string should consist of unescaped symbol characters, which will be utilized internally in a RegExp expression in the following format: `[${escapeStringRegexp(restrictSymbolsTo)}]`.\n  - Additionally, you can import and use the owaspSymbols to limit the symbols to those recommended by OWASP.\n\n**Password Default Options**\n\nThe default options can be required:\n\n```javascript\nconst { defaultOptions } = require(\"./index\");\n// OR\nimport { defaultOptions } from 'check-password-strength'\n```\n\ndefault options:\n```javascript\n[\n  {\n    id: 0,\n    value: \"Too weak\",\n    minDiversity: 0,\n    minLength: 0\n  },\n  {\n    id: 1,\n    value: \"Weak\",\n    minDiversity: 2,\n    minLength: 8\n  },\n  {\n    id: 2,\n    value: \"Medium\",\n    minDiversity: 4,\n    minLength: 10\n  },\n  {\n    id: 3,\n    value: \"Strong\",\n    minDiversity: 4,\n    minLength: 12\n  }\n]\n```\n\nTo override the default options, simply pass your custom array as the second argument:\n\n  - id: correspond to the return id attribute.\n  - value: correspond to the return value attribute.\n  - minDiversity: between 0 and 4, correspond to the minimum of different criterias ('lowercase', 'uppercase', 'symbol', 'number') that should be met to pass the password strength\n  - minLength: minimum length of the password that should be met to pass the password strength\n\n**You can use an array containing fewer or more than four items to define the levels of trust.** However, the first element must have both the minDiversity and minLength parameters set to 0. This means that the first element should always represent a \"too weak\" option.\n\n### Result\n\nThe result is an object containing the following values (unless you override the `options`):\n\n| Property | Desc.                                                           |\n| -------- | --------------------------------------------------------------- |\n| id       | **0** = Too weak, **1** = Weak \u0026 **2** = Medium, **3** = Strong |\n| value    | Too weak, Weak, Medium \u0026 Strong                                 |\n| contains | lowercase, uppercase, number and / or symbol                    |\n| length   | length of the password                                          |\n\nIf you want to translate the value (Too weak → Trop faible), you can translate it based on the return value, or override the `defaultOptions` option, which will be passed back as the function's return value.\n\n## Contribute\n\nFeel free to clone or fork this project:  `https://github.com/deanilvincent/check-password-strength.git`\n\nContributions \u0026 pull requests are welcome!\n\nI'll be glad if you give this project a ★ on [Github](https://github.com/deanilvincent/check-password-strength) :)\n\n## changelog\n\n- v3: allow all symbols by default (any character except the 26 latin lowercase, uppercase letters and 10 digits) \u0026 set the default min length to 12 instead of 10\n- v2: allow configuration through `options` object\n- v1: first version\n\n***\n\nKudos to [@Ennoriel](https://github.com/Ennoriel) and his efforts for making v2 and v3 possible!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanilvincent%2Fcheck-password-strength","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeanilvincent%2Fcheck-password-strength","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanilvincent%2Fcheck-password-strength/lists"}