js-generate-password 0.0.1

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.
@@ -0,0 +1,118 @@
1
+ <!-- prettier-ignore-start -->
2
+ <!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
3
+
4
+ # z-password-generator
5
+
6
+ z-password-generator is usable for every javascript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.
7
+
8
+ The characters that may be choosen from are
9
+
10
+ - Lowercase Characters
11
+ - Uppercase Characters
12
+ - Numbers
13
+ - Symbols
14
+
15
+ The user may also specify the minimum number of character for each type.
16
+
17
+ ## Installation
18
+
19
+ `npm install z-password-generator`
20
+ or
21
+ `yarn add z-password-generator`
22
+
23
+ ## Usage
24
+
25
+ For the password to be generated, **parameters** are able to pass as an optional **options** object.
26
+
27
+ ```javascript
28
+ import PasswordGenerator from "z-password-generator";
29
+ const password = PasswordGenerator({
30
+ length: 14,
31
+ symbols: true,
32
+ });
33
+ console.log(password);
34
+ ```
35
+
36
+ If no parameter is passed, the default parameter will be taken as :
37
+
38
+ ```javascript
39
+ options = {
40
+ length: 10,
41
+ lowercase: true,
42
+ uppercase: true,
43
+ numbers: true,
44
+ symbols: false,
45
+ exclude: "",
46
+ minLengthLowercase: 1,
47
+ minLengthUppercase: 1,
48
+ minLengthNumbers: 1,
49
+ minLengthSymbols: 0,
50
+ };
51
+ ```
52
+
53
+ ### Available options
54
+
55
+ Any of these can be passed into the options object for each function.
56
+
57
+ | Name | Description | Default Value |
58
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
59
+ | length | Integer, length of password. | 10 |
60
+ | lowercase\* | Boolean, put lowercase letters in password | true |
61
+ | uppercase\* | Boolean, put uppercase letters in password. | true |
62
+ | numbers\* | Boolean, put numbers in password. | true |
63
+ | symbols\* | Boolean, put symbols in password. | false |
64
+ | exclude | String, characters to be excluded from password. | '' |
65
+ | minLengthLowercase | only if **lowercase** is set to **true**, minLengthLowercase will create a password that will have minimum number of lower case characters in the password. | 1 |
66
+ | minLengthUppercase | only if **uppercase** is set to **true**, minLengthUppercase will create a password that will have minimum number of upper case characters in the password. | 1 |
67
+ | minLengthNumbers | only if **numbers** is set to **true**, minLengthNumbers will create a password that will have minimum number of numbers in the password. | 1 |
68
+ | minLengthSymbols | only if **symbols** is set to **true**, minLengthSymbols will create a password that will have minimum number of symbols in the password. | 1 |
69
+
70
+ \*At least one should be true.
71
+
72
+ ## Example
73
+
74
+ - **No Options passed.**
75
+
76
+ ```javscript
77
+ const PasswordGenerator = require("z-password-generator");
78
+ const password = PasswordGenerator();
79
+ console.log(password);
80
+ ```
81
+
82
+ In the above case, no parameter is passed as option. Therefore the default values will be taken - which will have alphabets, both upper and lower case, numbers, and will be of length 10 characters.
83
+
84
+ ```javascript
85
+ xDU6izb3PV;
86
+ ```
87
+
88
+ - **Length parameter passed.**
89
+
90
+ ```javascript
91
+ options={
92
+ length : 25;
93
+ }
94
+ password = PasswordGenerator(options);
95
+ console.log(password);
96
+ ```
97
+
98
+ The password generated is
99
+
100
+ ```javascript
101
+ U4c3KpQP5UrbZgTcrqMgFeI3R;
102
+ ```
103
+
104
+ - **exclude parameter passed.**
105
+
106
+ ```javascript
107
+ options={
108
+ exclude : 'abc567XYZ';
109
+ }
110
+ password = PasswordGenerator(options);
111
+ console.log(password);
112
+ ```
113
+
114
+ The generated password wouldn't has none of 'abc567XYZ' characters
115
+
116
+ ```javascript
117
+ J9yCfttQNj;
118
+ ```
@@ -0,0 +1,118 @@
1
+ <!-- prettier-ignore-start -->
2
+ <!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
3
+
4
+ # easy-password-generator
5
+
6
+ easy-password-generator is usable for every javascript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.
7
+
8
+ The characters that may be choosen from are
9
+
10
+ - Lowercase Characters
11
+ - Uppercase Characters
12
+ - Numbers
13
+ - Symbols
14
+
15
+ The user may also specify the minimum number of character for each type.
16
+
17
+ ## Installation
18
+
19
+ `npm install easy-password-generator`
20
+ or
21
+ `yarn add easy-password-generator`
22
+
23
+ ## Usage
24
+
25
+ For the password to be generated, **parameters** are able to pass as an optional **options** object.
26
+
27
+ ```javascript
28
+ import PasswordGenerator from "easy-password-generator";
29
+ const password = PasswordGenerator({
30
+ length: 14,
31
+ symbols: true,
32
+ });
33
+ console.log(password);
34
+ ```
35
+
36
+ If no parameter is passed, the default parameter will be taken as :
37
+
38
+ ```javascript
39
+ options = {
40
+ length: 10,
41
+ lowercase: true,
42
+ uppercase: true,
43
+ numbers: true,
44
+ symbols: false,
45
+ exclude: "",
46
+ minLengthLowercase: 1,
47
+ minLengthUppercase: 1,
48
+ minLengthNumbers: 1,
49
+ minLengthSymbols: 0,
50
+ };
51
+ ```
52
+
53
+ ### Available options
54
+
55
+ Any of these can be passed into the options object for each function.
56
+
57
+ | Name | Description | Default Value |
58
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
59
+ | length | Integer, length of password. | 10 |
60
+ | lowercase\* | Boolean, put lowercase letters in password | true |
61
+ | uppercase\* | Boolean, put uppercase letters in password. | true |
62
+ | numbers\* | Boolean, put numbers in password. | true |
63
+ | symbols\* | Boolean, put symbols in password. | false |
64
+ | exclude | String, characters to be excluded from password. | '' |
65
+ | minLengthLowercase | only if **lowercase** is set to **true**, minLengthLowercase will create a password that will have minimum number of lower case characters in the password. | 1 |
66
+ | minLengthUppercase | only if **uppercase** is set to **true**, minLengthUppercase will create a password that will have minimum number of upper case characters in the password. | 1 |
67
+ | minLengthNumbers | only if **numbers** is set to **true**, minLengthNumbers will create a password that will have minimum number of numbers in the password. | 1 |
68
+ | minLengthSymbols | only if **symbols** is set to **true**, minLengthSymbols will create a password that will have minimum number of symbols in the password. | 1 |
69
+
70
+ \*At least one should be true.
71
+
72
+ ## Example
73
+
74
+ - **No Options passed.**
75
+
76
+ ```javscript
77
+ const PasswordGenerator = require("easy-password-generator");
78
+ const password = PasswordGenerator();
79
+ console.log(password);
80
+ ```
81
+
82
+ In the above case, no parameter is passed as option. Therefore the default values will be taken - which will have alphabets, both upper and lower case, numbers, and will be of length 10 characters.
83
+
84
+ ```javascript
85
+ xDU6izb3PV;
86
+ ```
87
+
88
+ - **Length parameter passed.**
89
+
90
+ ```javascript
91
+ options={
92
+ length : 25;
93
+ }
94
+ password = PasswordGenerator(options);
95
+ console.log(password);
96
+ ```
97
+
98
+ The password generated is
99
+
100
+ ```javascript
101
+ U4c3KpQP5UrbZgTcrqMgFeI3R;
102
+ ```
103
+
104
+ - **exclude parameter passed.**
105
+
106
+ ```javascript
107
+ options={
108
+ exclude : 'abc567XYZ';
109
+ }
110
+ password = PasswordGenerator(options);
111
+ console.log(password);
112
+ ```
113
+
114
+ The generated password wouldn't has none of 'abc567XYZ' characters
115
+
116
+ ```javascript
117
+ J9yCfttQNj;
118
+ ```
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "z-password-generator",
3
+ "version": "0.2.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/Mustafa-Zahedi/random-password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "password generator",
17
+ "random password",
18
+ "generate",
19
+ "password",
20
+ "generator",
21
+ "unique",
22
+ "nodejs",
23
+ "nextjs",
24
+ "react",
25
+ "reactjs",
26
+ "random"
27
+ ],
28
+ "author": "Mustafa Zahedi",
29
+ "license": "ISC",
30
+ "bugs": {
31
+ "url": "https://github.com/Mustafa-Zahedi/random-password-generator/issues"
32
+ },
33
+ "homepage": "https://github.com/Mustafa-Zahedi/random-password-generator#readme"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "z-password-generator",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "password generator",
17
+ "random password",
18
+ "generate",
19
+ "password",
20
+ "generator",
21
+ "unique",
22
+ "nodejs",
23
+ "nextjs",
24
+ "react",
25
+ "reactjs",
26
+ "random"
27
+ ],
28
+ "author": "Mustafa Zahedi",
29
+ "license": "ISC",
30
+ "bugs": {
31
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
32
+ },
33
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "z-password-generator",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "password generator",
17
+ "random password",
18
+ "generate",
19
+ "password",
20
+ "generator",
21
+ "unique",
22
+ "nodejs",
23
+ "nextjs",
24
+ "react",
25
+ "reactjs",
26
+ "random"
27
+ ],
28
+ "author": "Ahmad Joya",
29
+ "license": "ISC",
30
+ "bugs": {
31
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
32
+ },
33
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "z-password-generator",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "password generator",
17
+ "random password",
18
+ "generate",
19
+ "password",
20
+ "generator",
21
+ "unique",
22
+ "nodejs",
23
+ "nextjs",
24
+ "react",
25
+ "reactjs",
26
+ "random"
27
+ ],
28
+ "author": "Ahmad Joya",
29
+ "license": "ISC",
30
+ "bugs": {
31
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
32
+ },
33
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "easy-password-generator",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "password generator",
17
+ "random password",
18
+ "generate",
19
+ "password",
20
+ "generator",
21
+ "unique",
22
+ "nodejs",
23
+ "nextjs",
24
+ "react",
25
+ "reactjs",
26
+ "random"
27
+ ],
28
+ "author": "Ahmad Joya",
29
+ "license": "ISC",
30
+ "bugs": {
31
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
32
+ },
33
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
34
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "easy-password-generator",
3
+ "version": "0.2.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "easy password generator",
17
+ "password generator",
18
+ "random password",
19
+ "generate",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/password-generator.git"
14
+ },
15
+ "keywords": [
16
+ "easy password generator",
17
+ "password generator",
18
+ "random password",
19
+ "generate",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/password-generator/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/password-generator#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "easy password generator",
17
+ "password generator",
18
+ "random password",
19
+ "generate",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "easy password generator",
17
+ "password generator",
18
+ "random password",
19
+ "generate",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Mustafa Zahedi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ <!-- prettier-ignore-start -->
2
+ <!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
3
+
4
+ # easy-password-generator
5
+
6
+ easy-password-generator is usable for every javascript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.
7
+
8
+ The characters that may be choosen from are
9
+
10
+ - Lowercase Characters
11
+ - Uppercase Characters
12
+ - Numbers
13
+ - Symbols
14
+
15
+ The user may also specify the minimum number of character for each type.
16
+
17
+ ## Installation
18
+
19
+ `npm install easy-password-generator`
20
+ or
21
+ `yarn add easy-password-generator`
22
+
23
+ ## Usage
24
+
25
+ For the password to be generated, **parameters** are able to pass as an optional **options** object.
26
+
27
+ ```javascript
28
+ import PasswordGenerator from "easy-password-generator";
29
+ const password = PasswordGenerator({
30
+ length: 14,
31
+ symbols: true,
32
+ });
33
+ console.log(password);
34
+ ```
35
+
36
+ If no parameter is passed, the default parameter will be taken as :
37
+
38
+ ```javascript
39
+ options = {
40
+ length: 10,
41
+ lowercase: true,
42
+ uppercase: true,
43
+ numbers: true,
44
+ symbols: false,
45
+ exclude: "",
46
+ minLengthLowercase: 1,
47
+ minLengthUppercase: 1,
48
+ minLengthNumbers: 1,
49
+ minLengthSymbols: 0,
50
+ };
51
+ ```
52
+
53
+ ### Available options
54
+
55
+ Any of these can be passed into the options object for each function.
56
+
57
+ | Name | Description | Default Value |
58
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
59
+ | length | Integer, length of password. | 10 |
60
+ | lowercase\* | Boolean, put lowercase letters in password | true |
61
+ | uppercase\* | Boolean, put uppercase letters in password. | true |
62
+ | numbers\* | Boolean, put numbers in password. | true |
63
+ | symbols\* | Boolean, put symbols in password. | false |
64
+ | exclude | String, characters to be excluded from password. | '' |
65
+ | minLengthLowercase | only if **lowercase** is set to **true**, minLengthLowercase will create a password that will have minimum number of lower case characters in the password. | 1 |
66
+ | minLengthUppercase | only if **uppercase** is set to **true**, minLengthUppercase will create a password that will have minimum number of upper case characters in the password. | 1 |
67
+ | minLengthNumbers | only if **numbers** is set to **true**, minLengthNumbers will create a password that will have minimum number of numbers in the password. | 1 |
68
+ | minLengthSymbols | only if **symbols** is set to **true**, minLengthSymbols will create a password that will have minimum number of symbols in the password. | 1 |
69
+
70
+ \*At least one should be true.
71
+
72
+ ## Example
73
+
74
+ - **No Options passed.**
75
+
76
+ ```javscript
77
+ const PasswordGenerator = require("easy-password-generator");
78
+ const password = PasswordGenerator();
79
+ console.log(password);
80
+ ```
81
+
82
+ In the above case, no parameter is passed as option. Therefore the default values will be taken - which will have alphabets, both upper and lower case, numbers, and will be of length 10 characters.
83
+
84
+ ```javascript
85
+ xDU6izb3PV;
86
+ ```
87
+
88
+ - **Length parameter passed.**
89
+
90
+ ```javascript
91
+ options={
92
+ length : 25;
93
+ }
94
+ password = PasswordGenerator(options);
95
+ console.log(password);
96
+ ```
97
+
98
+ The password generated is
99
+
100
+ ```javascript
101
+ U4c3KpQP5UrbZgTcrqMgFeI3R;
102
+ ```
103
+
104
+ - **exclude parameter passed.**
105
+
106
+ ```javascript
107
+ options={
108
+ exclude : 'abc567XYZ';
109
+ }
110
+ password = PasswordGenerator(options);
111
+ console.log(password);
112
+ ```
113
+
114
+ The generated password wouldn't has none of 'abc567XYZ' characters
115
+
116
+ ```javascript
117
+ J9yCfttQNj;
118
+ ```
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ const passwords = require("./lib/password-generator.js");
2
+ const errorCheck = require("./lib/check-options-error");
3
+ const processOptions = require("./lib/process-options");
4
+
5
+ function PasswordGenerator(options) {
6
+ options = processOptions(options);
7
+
8
+ errorCheck(options);
9
+
10
+ const pswd = passwords(options);
11
+ console.log("password: ", pswd);
12
+
13
+ return pswd;
14
+ }
15
+
16
+ PasswordGenerator({ exclude: "abc567XYZ" });
17
+
18
+ module.exports = PasswordGenerator;
@@ -0,0 +1,40 @@
1
+ const checkError = (options) => {
2
+ const {
3
+ length,
4
+ lowercase,
5
+ uppercase,
6
+ numbers,
7
+ symbols,
8
+ minLengthLowercase,
9
+ minLengthUppercase,
10
+ minLengthNumbers,
11
+ minLengthSymbols,
12
+ } = options;
13
+
14
+ //Checking if the sum of minimum characters of Lowercase, uppercase, numbers and special case is greater than the total password length.
15
+ if (
16
+ minLengthLowercase +
17
+ minLengthUppercase +
18
+ minLengthNumbers +
19
+ minLengthSymbols >
20
+ length
21
+ ) {
22
+ throw new Error(
23
+ "Sum of Minimum Characters in the passwords greater than the length of the Password to be generated."
24
+ );
25
+ }
26
+
27
+ //Checking if lowercase, uppercase , numbers and special characters have all been set to false.
28
+ if (
29
+ lowercase == false &&
30
+ uppercase == false &&
31
+ numbers == false &&
32
+ symbols == false
33
+ ) {
34
+ throw new Error(
35
+ "Alphabets, Numbers and Symbols are all set to False. No valid Characters to generate the Password."
36
+ );
37
+ }
38
+ };
39
+
40
+ module.exports = checkError;
@@ -0,0 +1,5 @@
1
+ const generateRandomNumbers = (upperLimit) => {
2
+ return (randomNumber = Math.floor(Math.random() * upperLimit));
3
+ };
4
+
5
+ module.exports = generateRandomNumbers;
@@ -0,0 +1,90 @@
1
+ const randomNumber = require("./generate-random-number");
2
+ const shuffleString = require("./shuffle-string");
3
+
4
+ const generatePassword = (options) => {
5
+ let pswd = "";
6
+ let minChar = "";
7
+ let {
8
+ length,
9
+ lowercase,
10
+ uppercase,
11
+ numbers,
12
+ symbols,
13
+ minLengthLowercase,
14
+ minLengthUppercase,
15
+ minLengthNumbers,
16
+ minLengthSymbols,
17
+ exclude,
18
+ } = options;
19
+
20
+ let lowercaseChar = "abcdefghijklmnopqrstuvwxyz";
21
+ lowercaseChar = removeExceptions(lowercaseChar, exclude);
22
+
23
+ let uppercaseChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
24
+ uppercaseChar = removeExceptions(uppercaseChar, exclude);
25
+
26
+ let numberChar = "0123456789";
27
+ numberChar = removeExceptions(numberChar, exclude);
28
+
29
+ let specialChar = "!#$%&'()*+,-./:;<=>?@[]^_{|}~";
30
+ specialChar = removeExceptions(specialChar, exclude);
31
+
32
+ // Generating a minChar string that holds minimum number of characters on the User Option Selection.
33
+ // The minChar variable will store the minimum number of characters for each type - lowercase, uppercase, numbers, and symbols.
34
+ // Then, the minChar variable is shuffled to make the password random.
35
+
36
+ upperLimit = lowercaseChar.length;
37
+ for (i = 0; i < minLengthLowercase; i++) {
38
+ minChar += lowercaseChar.charAt(randomNumber(upperLimit));
39
+ }
40
+
41
+ upperLimit = uppercaseChar.length;
42
+ for (i = 0; i < minLengthUppercase; i++) {
43
+ minChar += uppercaseChar.charAt(randomNumber(upperLimit));
44
+ }
45
+
46
+ upperLimit = numberChar.length;
47
+ for (i = 0; i < minLengthNumbers; i++) {
48
+ minChar += numberChar.charAt(randomNumber(upperLimit));
49
+ }
50
+
51
+ upperLimit = specialChar.length;
52
+ for (i = 0; i < minLengthSymbols; i++) {
53
+ minChar += specialChar.charAt(randomNumber(upperLimit));
54
+ }
55
+
56
+ //Shuffling the minChar to generate a password that holds minimum criteria.
57
+ pswd = pswd + shuffleString(minChar);
58
+
59
+ characterString = "";
60
+
61
+ characterString = lowercase
62
+ ? characterString + lowercaseChar
63
+ : characterString;
64
+
65
+ characterString = uppercase
66
+ ? characterString + uppercaseChar
67
+ : characterString;
68
+
69
+ characterString = numbers ? characterString + numberChar : characterString;
70
+
71
+ characterString = symbols ? characterString + specialChar : characterString;
72
+
73
+ remainingChar = length - pswd.length;
74
+
75
+ upperLimit = characterString.length;
76
+
77
+ for (i = 0; i < remainingChar; i++) {
78
+ pswd += characterString.charAt(randomNumber(upperLimit));
79
+ }
80
+ return pswd;
81
+ };
82
+
83
+ const removeExceptions = (str, EXCEPTIONS) => {
84
+ EXCEPTIONS?.split("").forEach((char) => {
85
+ str = str.replace(char, "");
86
+ });
87
+ return str;
88
+ };
89
+
90
+ module.exports = generatePassword;
@@ -0,0 +1,72 @@
1
+ const processOption = (options) => {
2
+ if (typeof options == "undefined") {
3
+ options = {
4
+ length: 10,
5
+ lowercase: true,
6
+ uppercase: true,
7
+ numbers: true,
8
+ symbols: false,
9
+ exclude: "",
10
+ minLengthLowercase: 1,
11
+ minLengthUppercase: 1,
12
+ minLengthNumbers: 1,
13
+ minLengthSymbols: 0,
14
+ };
15
+ } else {
16
+ options.length = typeof options.length == "undefined" ? 10 : options.length;
17
+
18
+ options.lowercase =
19
+ typeof options.lowercase == "undefined" ? true : options.lowercase;
20
+
21
+ options.uppercase =
22
+ typeof options.uppercase == "undefined" ? true : options.uppercase;
23
+
24
+ options.numbers =
25
+ typeof options.numbers == "undefined" ? true : options.numbers;
26
+
27
+ options.symbols =
28
+ typeof options.symbols == "undefined" ? false : options.symbols;
29
+
30
+ if (options.lowercase) {
31
+ options.minLengthLowercase =
32
+ typeof options.minLengthLowercase == "undefined"
33
+ ? 1
34
+ : options.minLengthLowercase;
35
+ } else {
36
+ options.minLengthLowercase = 0;
37
+ }
38
+
39
+ if (options.uppercase) {
40
+ options.minLengthUppercase =
41
+ typeof options.minLengthUppercase == "undefined"
42
+ ? 1
43
+ : options.minLengthUppercase;
44
+ } else {
45
+ options.minLengthUppercase = 0;
46
+ }
47
+
48
+ if (options.numbers) {
49
+ options.minLengthNumbers =
50
+ typeof options.minLengthNumbers == "undefined"
51
+ ? 1
52
+ : options.minLengthNumbers;
53
+ } else {
54
+ options.minLengthNumbers = 0;
55
+ }
56
+
57
+ if (options.symbols) {
58
+ options.minLengthSymbols =
59
+ typeof options.minLengthSymbols == "undefined"
60
+ ? 1
61
+ : options.minLengthSymbols;
62
+ } else {
63
+ options.minLengthSymbols = 0;
64
+ }
65
+
66
+ options.exclude =
67
+ typeof options.exclude == "undefined" ? "" : options.exclude;
68
+ }
69
+ return options;
70
+ };
71
+
72
+ module.exports = processOption;
@@ -0,0 +1,14 @@
1
+ const shuffleString = (str) => {
2
+ let arr = str.split("");
3
+ n = arr.length;
4
+
5
+ for (let i = n - 1; i > 0; i--) {
6
+ let j = Math.floor(Math.random() * (i + 1));
7
+ let tmp = arr[i];
8
+ arr[i] = arr[j];
9
+ arr[j] = tmp;
10
+ }
11
+ return arr.join("");
12
+ };
13
+
14
+ module.exports = shuffleString;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "js-generate-password",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Password Generator for using in javascirpt/typscript based projects.",
6
+ "main": "index.js",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ahmadjoya/js-generate-password.git"
14
+ },
15
+ "keywords": [
16
+ "js password generator",
17
+ "generate password",
18
+ "password generator",
19
+ "random password",
20
+ "password",
21
+ "generator",
22
+ "unique",
23
+ "nodejs",
24
+ "nextjs",
25
+ "react",
26
+ "reactjs",
27
+ "random"
28
+ ],
29
+ "author": "Ahmad Joya",
30
+ "license": "ISC",
31
+ "bugs": {
32
+ "url": "https://github.com/ahmadjoya/js-generate-password/issues"
33
+ },
34
+ "homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
35
+ }