generate-pw 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,23 +8,37 @@
8
8
  <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/zh-cn#readme">简体中文</a> |
9
9
  <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/zh-tw#readme">繁體中文</a> |
10
10
  <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/hi#readme">हिंदी</a> |
11
- <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/bn#readme">বাংলা</a>
11
+ <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/bn#readme">বাংলা</a> |
12
+ <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/de#readme">Deutsch</a> |
13
+ <a href="https://github.com/adamlui/js-utils/tree/main/generate-pw/docs/es#readme">Español</a>
12
14
  </h6>
13
15
  </div>
14
16
 
15
17
  # > generate-pw
16
18
 
17
- ### Randomly generate cryptographically-secure passwords.
19
+ ### Randomly generate, strengthen, and validate cryptographically-secure passwords.
18
20
 
19
21
  <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
20
- <a href="https://github.com/adamlui/js-utils/releases/tag/generate-pw-1.4.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.4.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
22
+ <a href="https://github.com/adamlui/js-utils/releases/tag/generate-pw-1.4.3"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.4.3-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
21
23
  <a href="https://www.npmjs.com/package/generate-pw?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/generate-pw?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
24
+ <a href="https://github.com/adamlui/js-utils/blob/generate-pw-1.4.3/generate-pw/dist/generate-pw.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-pw/dist/generate-pw.min.js?branch=generate-pw-1.4.3&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
22
25
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-pw/src/generate-pw.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-pw%2Fsrc%2Fgenerate-pw.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
23
26
 
24
27
  <br>
25
28
 
26
29
  <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
27
30
 
31
+ ## 💡 About
32
+
33
+ **generate-pw** is a lightweight, easy-to-use library that allows you to randomly generate, strengthen & validate cryptographically-secure password(s).
34
+
35
+ - **No external dependencies —** Only built-in crypto methods used for secure randomization
36
+ - **Highly customizable —** Specify length, quantity, charsets to use, etc.
37
+ - **Multi-environment support —** Use in Node.js or the web browser
38
+ - **Command line usable —** Just type `generate-pw`, that's it
39
+
40
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
41
+
28
42
  ## ⚡ Installation
29
43
 
30
44
  As a **global utility**:
@@ -66,14 +80,14 @@ const pw = require('generate-pw');
66
80
  #### <> HTML script tag:
67
81
 
68
82
  ```html
69
- <script src="https://cdn.jsdelivr.net/npm/generate-pw@1.4.1/dist/generate-pw.min.js"></script>
83
+ <script src="https://cdn.jsdelivr.net/npm/generate-pw@1.4.3/dist/generate-pw.min.js"></script>
70
84
  ```
71
85
 
72
86
  #### ES6:
73
87
 
74
88
  ```js
75
89
  (async () => {
76
- await import('https://cdn.jsdelivr.net/npm/generate-pw@1.4.1/dist/generate-pw.min.js');
90
+ await import('https://cdn.jsdelivr.net/npm/generate-pw@1.4.3/dist/generate-pw.min.js');
77
91
  // Your code here...
78
92
  })();
79
93
  ```
@@ -82,7 +96,7 @@ const pw = require('generate-pw');
82
96
 
83
97
  ```js
84
98
  ...
85
- // @require https://cdn.jsdelivr.net/npm/generate-pw@1.4.1/dist/generate-pw.min.js
99
+ // @require https://cdn.jsdelivr.net/npm/generate-pw@1.4.3/dist/generate-pw.min.js
86
100
  // ==/UserScript==
87
101
 
88
102
  // Your code here...
@@ -90,7 +104,7 @@ const pw = require('generate-pw');
90
104
 
91
105
  <br>
92
106
 
93
- **💡 Note:** To always import the latest version (not recommended in production!) remove the `@1.4.1` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-pw/dist/generate-pw.min.js`
107
+ **💡 Note:** To always import the latest version (not recommended in production!) remove the `@1.4.3` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-pw/dist/generate-pw.min.js`
94
108
 
95
109
  <br>
96
110
 
@@ -285,6 +299,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
285
299
 
286
300
  <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
287
301
 
288
- <a href="https://github.com/adamlui/js-utils">**JavaScript utilities**</a> /
289
- <a href="https://github.com/adamlui/js-utils/discussions">Discuss</a> /
302
+ ## 🛠️ Related utilities
303
+
304
+ ### <img height=21px src="https://i.imgur.com/kvf7fXm.png"> [generate-ip](https://js-utils.com/generate-ip) <a href="https://github.com/toolleeo/cli-apps#networking"><img height=18 src="https://awesome.re/mentioned-badge.svg"></a>
305
+
306
+ > Randomly generate, format, and validate IPv4/IPv6 addresses.
307
+ <br>[Install](https://github.com/adamlui/js-utils/tree/main/generate-ip#-installation) /
308
+ [Readme](https://github.com/adamlui/js-utils/tree/main/generate-ip#readme) /
309
+ [API usage](https://github.com/adamlui/js-utils/tree/main/generate-ip#-api-usage) /
310
+ [CLI usage](https://github.com/adamlui/js-utils/tree/main/generate-ip#-command-line-usage) /
311
+ [Discuss](https://js-utils.com/discussions)
312
+
313
+ ### <a href="https://js-utils.com/geolocate"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/adamlui/js-utils/main/geolocate/media/images/icons/wire-globe/white/icon32.png"><img height=22 src="https://raw.githubusercontent.com/adamlui/js-utils/main/geolocate/media/images/icons/wire-globe/black/icon32.png"></picture> geolocate</a>
314
+
315
+ > Fetch IP geolocation data from the CLI.
316
+ <br>[Install](https://github.com/adamlui/js-utils/tree/main/geolocate#-installation) /
317
+ [Readme](https://github.com/adamlui/js-utils/tree/main/geolocate#readme) /
318
+ [CLI usage](https://github.com/adamlui/js-utils/tree/main/geolocate#-command-line-usage) /
319
+ [API usage](https://github.com/adamlui/js-utils/tree/main/geolocate#-api-usage) /
320
+ [Discuss](https://js-utils.com/discussions)
321
+
322
+ <br>
323
+
324
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
325
+
326
+ <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/white/icon32x27.png"><img height=11 src="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/dark-gray/icon32x27.png"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
327
+ <a href="https://js-utils.com/discussions">Discuss</a> /
290
328
  <a href="#-generate-pw">Back to top ↑</a>
@@ -1 +1 @@
1
- let h;try{h=require("crypto").randomInt}catch(e){const t=window.crypto||window.msCrypto;h=(e,r)=>{var o=t?.getRandomValues(new Uint32Array(1))[0]/4294967295||Math.random();return Math.floor(o*(r-e))+e}}const w={lower:"abcdefghijklmnopqrstuvwxyz",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",numbers:"0123456789",symbols:"!@#$%^&*()-_=+[]{}/\\|;:'\",.<>?"};function g(t={}){const r={verbose:!0,length:8,qty:1,charset:"",exclude:"",numbers:!1,symbols:!1,lowercase:!0,uppercase:!0,strict:!1},e=JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),o=Object.keys(r).join(", "),s=Object.keys(r).filter(e=>"boolean"==typeof r[e]),n=Object.keys(r).filter(e=>Number.isInteger(r[e]));var a=()=>{console.info(`generatePassword() » Valid options: [ ${o} ]`),console.info("generatePassword() » If omitted, default settings are: "+e)};if("object"==typeof t){for(const f in t){if(!Object.prototype.hasOwnProperty.call(r,f))return console.error(`generatePassword() » ERROR: \`${f}\` is an invalid option.`),void a();if(s.includes(f)&&"boolean"!=typeof t[f])return console.error(`generatePassword() » ERROR: [${f}] option can only be \`true\` or \`false\`.`);if(n.includes(f)&&(t[f]=parseInt(t[f],10),isNaN(t[f])||t[f]<1))return console.error(`generatePassword() » ERROR: [${f}] option can only be \`true\` or \`false\`.`)}if(1<(t={...r,...t}).qty){const{qty:d,...p}=t;return u(d,p)}{var i,l="generatePasswords"===g.caller?.name;t.verbose&&!l&&console.info("generatePassword() » Initializing character set...");let r=t.charset||(t.numbers?w.numbers:"")+(t.symbols?w.symbols:"")+(t.lowercase?w.lower:"")+(t.uppercase?w.upper:""),o=(""===r&&(r=w.lower+w.upper),t.exclude&&(t.verbose&&!l&&console.info("generatePassword() » Removing excluded characters..."),r=r.replace(new RegExp(`[${t.exclude}]`,"g"),"")),t.verbose&&!l&&console.info("generatePassword() » Generating password..."),"");for(let e=0;e<t.length;e++){var c=h(0,r.length);o+=r.charAt(c)}return t.strict&&(t.verbose&&!l&&console.info("generatePassword() » Enforcing strict mode..."),i=["number","symbol","lower","upper"].filter(e=>t[e+"s"]||t[e+"case"]),o=y(o,i)),t.verbose&&!l&&(console.info("generatePassword() » Password generated!"),"undefined"==typeof require||require.main.filename.endsWith("cli.js")||console.info("generatePassword() » Check returned string.")),o}}console.error("generatePassword() » ERROR: [options] can only be an object of key/values."),console.info("generatePassword() » Example valid call: generatePassword({ verbose: false, numbers: true })"),a()}function u(r,o={}){const t={verbose:!0,length:8,charset:"",exclude:"",numbers:!1,symbols:!1,lowercase:!0,uppercase:!0,strict:!1};if(r=parseInt(r,10),isNaN(r)||r<1)return console.error("generatePasswords() » ERROR: 1st arg <qty> can only be an integer > 0.");const e=JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),s=Object.keys(t).join(", "),n=Object.keys(t).filter(e=>"boolean"==typeof t[e]),a=Object.keys(t).filter(e=>Number.isInteger(t[e]));var i=()=>{console.info(`generatePasswords() » Valid options: [ ${s} ]`),console.info("generatePasswords() » If omitted, default settings are: "+e)};if("object"==typeof o){for(const c in o){if(!Object.prototype.hasOwnProperty.call(t,c))return console.error(`generatePasswords() » ERROR: \`${c}\` is an invalid option.`),void i();if(n.includes(c)&&"boolean"!=typeof o[c])return console.error(`generatePassword() » ERROR: [${c}] option can only be \`true\` or \`false\`.`);if(a.includes(c)&&(o[c]=parseInt(o[c],10),isNaN(o[c])||o[c]<1))return console.error(`generatePassword() » ERROR: [${c}] option can only be an integer > 0.`)}(o={...t,...o}).verbose&&console.info(`generatePasswords() » Generating password${1<r?"s":""}...`);var l=[];for(let e=0;e<r;e++)l.push(g(o));return o.verbose&&console.info(`generatePasswords() » Password${1<r?"s":""} generated!`),"undefined"==typeof require||require.main.filename.endsWith("cli.js")||console.info("generatePasswords() » Check returned array."),l}console.error("generatePasswords() » ERROR: 2nd arg [options] can only be an object of key/values."),console.info("generatePasswords() » Example valid call: generatePasswords(3, { verbose: false, symbols: true })"),i()}function y(t,s=["number","symbol","lower","upper"],e={}){var n={verbose:!0};if("string"!=typeof t)return console.error("strictify() » ERROR: 1st arg <password> must be a string.");var r=["number","symbol","lower","upper"];for(const p of s=Array.isArray(s)?s:[s])if(!r.includes(p))return console.error(`strictify() » ERROR: 2nd arg \`${p}\` is an invalid character type.`),console.info(`strictify() » Valid character types: [ ${r.map(e=>`'${e}'`).join(", ")} ]`),void console.info("strictify() » Pass one as a string or more as an array, or all types will be required.");const o=JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),a=Object.keys(n).join(", ");var i=()=>{console.info(`strictify() » Valid options: [ ${a} ]`),console.info("strictify() » If omitted, default settings are: "+o)};if("object"==typeof e){for(const g in e){if(!Object.prototype.hasOwnProperty.call(n,g))return console.error(`strictify() » ERROR: \`${g}\` is an invalid option.`),void i();if("boolean"!=typeof e[g])return console.error(`strictify() » ERROR: [${g}] option can only be set to \`true\` or \`false\`.`)}e={...n,...e};var l={};for(const u of s)l["has"+u.charAt(0).toUpperCase()+u.slice(1)]=!1;for(let e=0;e<t.length;e++)for(const y of s)(w[y]||w[y+"s"]).includes(t.charAt(e))&&(l["has"+y.charAt(0).toUpperCase()+y.slice(1)]=!0);e.verbose&&console.info("strictify() » Strictifying password...");var c=Math.min(t.length,s.length),f=[];let r=0,o=t;for(const b of s)if(r<c&&!l["has"+b.charAt(0).toUpperCase()+b.slice(1)]){let e;for(;e=h(0,t.length),f.includes(e););f.push(e);var d=w[b]||w[b+"s"];o=o.substring(0,e)+d.charAt(h(0,d.length))+o.substring(e+1),r++}return e.verbose&&(0<r?(console.info("strictify() » Password is now strict!"),console.info("strictify() » Check returned string.")):(console.info(`strictify() » Password already includes ${s.join(" + ")} characters!`),console.info("strictify() » No modifications made."))),o}console.error("strictify() » ERROR: 3rd arg [options] can only be an object of key/values."),console.info("strictify() » Example valid call: strictify('pa55word', ['symbol', 'upper'], { verbose: false })"),i()}function e(r,o={}){var t={minLength:8,minLower:1,minUpper:1,minNumber:1,minSymbol:1},s={verbose:!0};if("string"!=typeof r)return console.error("validateStrength() » ERROR: 1st arg <password> must be a string.");const e=JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(s).join(", ");var a=()=>{console.info(`validateStrength() » Valid options: [ ${n} ]`),console.info("validateStrength() » If omitted, default settings are: "+e)};if("object"==typeof o){for(const c in o){if(!Object.prototype.hasOwnProperty.call(s,c))return console.error(`validateStrength() » ERROR: \`${c}\` is an invalid option.`),void a();if("boolean"!=typeof o[c])return console.error(`validateStrength() » ERROR: [${c}] option can only be set to \`true\` or \`false\`.`)}(o={...s,...o}).verbose&&console.info("validateStrength() » Validating password strength...");var i={lower:0,upper:0,number:0,symbol:0};for(const f of r)for(const d of Object.keys(i))(w[d]||w[d+"s"]).includes(f)&&i[d]++;var l=[];r.length<t.minLength&&l.push(`Make it at least ${t.minLength} characters long.`);for(const p of Object.keys(i))i[p]<t["min"+p.charAt(0).toUpperCase()+p.slice(1)]&&l.push("Include at least one "+p+`${["upper","lower"].includes(p)?"case letter":""}.`);let e=0;e+=r.length>=t.minLength?20:0;for(const g of Object.keys(i))e+=i[g]>=t["min"+g.charAt(0).toUpperCase()+g.slice(1)]?20:0;return o.verbose&&(console.info("validateStrength() » Password strength validated!"),console.info("validateStrength() » Check returned object for score/recommendations.")),{strengthScore:e,recommendations:l,isGood:80<=e}}console.error("validateStrength() » ERROR: 2nd arg [options] can only be an object of key/values."),console.info("validateStrength() » Example valid call: validateStrength('pa55word', { verbose: false })"),a()}const r={generatePassword:g,generatePasswords:u,strictify:y,validateStrength:e};try{module.exports={...r}}catch(e){}try{window.pw={...r}}catch(e){}
1
+ let p;try{({randomInt:p}=require("crypto"))}catch(e){const s=window.crypto||window.msCrypto;p=(e,r)=>{var o=s?.getRandomValues(new Uint32Array(1))[0]/4294967295||Math.random();return Math.floor(o*(r-e))+e}}const g={lower:"abcdefghijklmnopqrstuvwxyz",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",numbers:"0123456789",symbols:"!@#$%^&*()-_=+[]{}/\\|;:'\",.<>?"};function a(s={}){var e={verbose:!0,length:8,qty:1,charset:"",exclude:"",numbers:!1,symbols:!1,lowercase:!0,uppercase:!0,strict:!1};if(b(s,e,"generatePassword({ verbose: false, numbers: true })")){if(1<(s={...e,...s}).qty){const{qty:r,...o}=s;return i(r,o)}{var t,e="generatePasswords"===a.caller?.name;s.verbose&&!e&&console.info("generatePassword() » Initializing character set...");let r=s.charset||(s.numbers?g.numbers:"")+(s.symbols?g.symbols:"")+(s.lowercase?g.lower:"")+(s.uppercase?g.upper:""),o=(""===r&&(r=g.lower+g.upper),s.exclude&&(s.verbose&&!e&&console.info("generatePassword() » Removing excluded characters..."),r=r.replace(new RegExp(`[${s.exclude}]`,"g"),"")),s.verbose&&!e&&console.info("generatePassword() » Generating password..."),"");for(let e=0;e<s.length;e++){var n=p(0,r.length);o+=r.charAt(n)}return s.strict&&(s.verbose&&!e&&console.info("generatePassword() » Enforcing strict mode..."),t=["number","symbol","lower","upper"].filter(e=>s[e+"s"]||s[e+"case"]),o=c(o,t)),s.verbose&&!e&&(console.info("generatePassword() » Password generated!"),"undefined"!=typeof require&&require.main.filename.endsWith("cli.js")||console.info("generatePassword() » Check returned string.")),o}}}function i(r,o={}){var e={verbose:!0,length:8,charset:"",exclude:"",numbers:!1,symbols:!1,lowercase:!0,uppercase:!0,strict:!1};if(r=parseInt(r,10),isNaN(r)||r<1)return console.error("generatePasswords() » ERROR: 1st arg <qty> can only be an integer > 0.");if(b(o,e,"generatePasswords(3, { verbose: false, symbols: true })")){(o={...e,...o}).verbose&&console.info(`generatePasswords() » Generating password${1<r?"s":""}...`);var s=[];for(let e=0;e<r;e++)s.push(a(o));return o.verbose&&console.info(`generatePasswords() » Password${1<r?"s":""} generated!`),"undefined"!=typeof require&&require.main.filename.endsWith("cli.js")||console.info("generatePasswords() » Check returned array."),s}}function c(s,t=["number","symbol","lower","upper"],e={}){var n={verbose:!0};if("string"!=typeof s)return console.error("strictify() » ERROR: 1st arg <password> must be a string.");var r=["number","symbol","lower","upper"];for(const o of t=Array.isArray(t)?t:[t])if(!r.includes(o))return console.error(`strictify() » ERROR: 2nd arg \`${o}\` is an invalid character type.`),console.info(`strictify() » Valid character types: [ ${r.map(e=>`'${e}'`).join(", ")} ]`),void console.info("strictify() » Pass one as a string or more as an array, or all types will be required.");if(b(e,n,"strictify('pa55word', ['symbol', 'upper'], { verbose: false })")){e={...n,...e};var a={};for(const f of t)a["has"+f.charAt(0).toUpperCase()+f.slice(1)]=!1;for(let e=0;e<s.length;e++)for(const d of t)(g[d]||g[d+"s"]).includes(s.charAt(e))&&(a["has"+d.charAt(0).toUpperCase()+d.slice(1)]=!0);e.verbose&&console.info("strictify() » Strictifying password...");var i=Math.min(s.length,t.length),c=[];let r=0,o=s;for(const u of t)if(r<i&&!a["has"+u.charAt(0).toUpperCase()+u.slice(1)]){let e;for(;e=p(0,s.length),c.includes(e););c.push(e);var l=g[u]||g[u+"s"];o=o.substring(0,e)+l.charAt(p(0,l.length))+o.substring(e+1),r++}return e.verbose&&(0<r?(console.info("strictify() » Password is now strict!"),console.info("strictify() » Check returned string.")):(console.info(`strictify() » Password already includes ${t.join(" + ")} characters!`),console.info("strictify() » No modifications made."))),o}}function e(r,o={}){var s={minLength:8,minLower:1,minUpper:1,minNumber:1,minSymbol:1},t={verbose:!0};if("string"!=typeof r)return console.error("validateStrength() » ERROR: 1st arg <password> must be a string.");if(b(o,t,"validateStrength('pa55word', { verbose: false })")){(o={...t,...o}).verbose&&console.info("validateStrength() » Validating password strength...");var n={lower:0,upper:0,number:0,symbol:0};for(const i of r)for(const c of Object.keys(n))(g[c]||g[c+"s"]).includes(i)&&n[c]++;var a=[];r.length<s.minLength&&a.push(`Make it at least ${s.minLength} characters long.`);for(const l of Object.keys(n))n[l]<s["min"+l.charAt(0).toUpperCase()+l.slice(1)]&&a.push("Include at least one "+l+`${["upper","lower"].includes(l)?"case letter":""}.`);let e=0;e+=r.length>=s.minLength?20:0;for(const f of Object.keys(n))e+=n[f]>=s["min"+f.charAt(0).toUpperCase()+f.slice(1)]?20:0;return o.verbose&&(console.info("validateStrength() » Password strength validated!"),console.info("validateStrength() » Check returned object for score/recommendations.")),{strengthScore:e,recommendations:a,isGood:80<=e}}}function b(e,r,o){const s=(b.caller?.name||"validateOptions")+"() » ",t=JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(r).join(", "),a=Object.keys(r).filter(e=>"boolean"==typeof r[e]),i=Object.keys(r).filter(e=>Number.isInteger(r[e]));var c=()=>{console.info(s+`Valid options: [ ${n} ]`),console.info(s+"If omitted, default settings are: "+t)};if("object"!=typeof e)return console.error(s+"ERROR: [options] can only be an object of key/values."),console.info(s+"Example valid call: "+o),c(),!1;for(const l in e){if(!Object.prototype.hasOwnProperty.call(r,l))return console.error(s+`ERROR: \`${l}\` is an invalid option.`),c(),!1;if(a.includes(l)&&"boolean"!=typeof e[l])return console.error(s+`ERROR: [${l}] option can only be \`true\` or \`false\`.`),!1;if(i.includes(l)&&(e[l]=parseInt(e[l],10),isNaN(e[l])||e[l]<1))return console.error(s+`ERROR: [${l}] option can only be an integer > 0.`),!1}return!0}const r={generatePassword:a,generatePasswords:i,strictify:c,validateStrength:e};try{module.exports={...r}}catch(e){}try{window.pw={...r}}catch(e){}
package/docs/LICENSE.md CHANGED
@@ -8,7 +8,9 @@
8
8
  <a href="zh-cn/LICENSE.md">简体中文</a> |
9
9
  <a href="zh-tw/LICENSE.md">繁體中文</a> |
10
10
  <a href="hi/LICENSE.md">हिंदी</a> |
11
- <a href="bn/LICENSE.md">বাংলা</a>
11
+ <a href="bn/LICENSE.md">বাংলা</a> |
12
+ <a href="de/LICENSE.md">Deutsch</a> |
13
+ <a href="es/LICENSE.md">Español</a>
12
14
  </h6>
13
15
  </div>
14
16
 
package/docs/SECURITY.md CHANGED
@@ -8,7 +8,9 @@
8
8
  <a href="zh-cn/SECURITY.md">简体中文</a> |
9
9
  <a href="zh-tw/SECURITY.md">繁體中文</a> |
10
10
  <a href="hi/SECURITY.md">हिंदी</a> |
11
- <a href="bn/SECURITY.md">বাংলা</a>
11
+ <a href="bn/SECURITY.md">বাংলা</a> |
12
+ <a href="de/SECURITY.md">Deutsch</a> |
13
+ <a href="es/SECURITY.md">Español</a>
12
14
  </h6>
13
15
  </div>
14
16
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "generate-pw",
3
- "version": "1.4.1",
4
- "description": "Randomly generate cryptographically-secure passwords.",
3
+ "version": "1.4.3",
4
+ "description": "Randomly generate, strengthen, and validate cryptographically-secure passwords.",
5
5
  "author": {
6
6
  "name": "Adam Lui",
7
7
  "email": "adam@kudoai.com",
8
8
  "url": "https://github.com/adamlui"
9
9
  },
10
- "homepage": "https://github.com/adamlui/js-utils/tree/main/generate-pw#readme",
10
+ "homepage": "https://js-utils.com/generate-pw",
11
11
  "license": "MIT",
12
12
  "main": "dist/generate-pw.min.js",
13
13
  "files": [
@@ -46,13 +46,13 @@
46
46
  "cli"
47
47
  ],
48
48
  "bugs": {
49
- "url": "https://github.com/adamlui/js-utils/issues"
49
+ "url": "https://js-utils.com/issues"
50
50
  },
51
51
  "funding": {
52
52
  "type": "github",
53
53
  "url": "https://github.com/sponsors/adamlui"
54
54
  },
55
55
  "devDependencies": {
56
- "@adamlui/minify.js": "^1.4.8"
56
+ "@adamlui/minify.js": "^1.4.10"
57
57
  }
58
58
  }