passfather 2.1.3 → 3.0.2-beta.0

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/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- MIT License
2
- Copyright (c) 2019-present, Evgeny Vyushin
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included
12
- in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ MIT License
2
+ Copyright (c) 2019-present, Evgeny Vyushin
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included
12
+ in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
20
  THE SOFTWARE.
package/README.md CHANGED
@@ -1,159 +1,167 @@
1
- # passfather
2
- [![version](https://img.shields.io/npm/v/passfather.svg?style=flat-square)](https://www.npmjs.com/package/passfather)
3
- [![license](https://img.shields.io/github/license/vyushin/passfather.svg?style=flat-square)](https://github.com/vyushin/passfather/blob/master/LICENSE)
4
-
5
- **passfather** is very fast and powerful utility with zero dependencies to generate strong password or random string.
6
-
7
- ## Features
8
-
9
- * Support browsers and Node.js;
10
- * Multiple random number algorithmes such as Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03.
11
- By default using [getRandomValues](https://developer.mozilla.org/ru/docs/Web/API/RandomSource/getRandomValues) for browsers and [getRandomBytes](https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback) for Node.js;
12
- * Support seed with entropy;
13
- * Optional using any of unicode chars (ranges). By default there are uppercase, lowercase, numbers and about ten symbols;
14
- * Any length;
15
-
16
- ## Installation
17
-
18
- ###### NPM
19
- `npm install --save passfather`
20
-
21
- ###### Yarn
22
- `yarn add passfather`
23
-
24
- ###### ESM
25
- ```html
26
- <script type="module">
27
- import passfather from 'https://unpkg.com/passfather@^2.1.2/dist/passfather.min.mjs'
28
- console.log( passfather() ); // Output "vFR_@1hDMhAr"
29
- </script>
30
- ```
31
-
32
- ###### UMD
33
-
34
- ```html
35
- <script src="https://unpkg.com/passfather@^2.1.2/dist/passfather.min.js"></script>
36
- <script>
37
- console.log( passfather() ); // Output "r_@1hDvFRMhA"
38
- </script>
39
- ```
40
-
41
- ## Example
42
-
43
- It's very easy! Just import **passfather** and run it.
44
-
45
- ```javascript
46
- import passfather from 'passfather';
47
- const password = passfather();
48
- console.log(password); // Output "9g'Jta75Gl3w"
49
- ```
50
-
51
- By default passfather doesn't require any options. But it's possible to pass options object to
52
- customize password.
53
-
54
- ```javascript
55
- import passfather from 'passfather';
56
- const password = passfather({
57
- numbers: true,
58
- uppercase: true,
59
- lowercase: true,
60
- symbols: false, // Disable symbols
61
- length: 16,
62
- });
63
- console.log(password); // Output "40rAe2hqiM0UzTmN"
64
- ```
65
-
66
- **NOTE:** if option object is passed then it merges with default options object.
67
-
68
- ## Options
69
-
70
- |Name|Type|Default|Description
71
- |---|---|---|---
72
- |numbers|boolean|`true`|Enable/disable numbers
73
- |uppercase|boolean|`true`|Enable/disable uppercase
74
- |lowercase|boolean|`true`|Enable/disable lowercase
75
- |symbols|boolean|`true`|Enable/disable symbols
76
- |length|integer|`12`|Final string length
77
- |prng|string|`default`|[Pseudorandom Number Generator](https://en.wikipedia.org/wiki/Pseudorandom_number_generator). Generating random string algorithm is using random numbers that generated by prng. Might be: default, Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03.
78
- |seed|array|[seed.js](https://github.com/vyushin/passfather/blob/master/src/seed.js)|Seed for prng. See [random seed](https://en.wikipedia.org/wiki/Random_seed). NOTE: Default value doesn't have enough entropy. Please, using your own values.
79
- |ranges|array|`null`|UTF-8 char ranges that will using to generate random string. See below.
80
-
81
- ### Options: `ranges` (custom chars)
82
-
83
- Passfather can make password containing custom chars.<br/>
84
- It's possible via ranges option.
85
-
86
- For example:
87
-
88
- ```javascript
89
- import passfather from 'passfather';
90
- const password = passfather({
91
- numbers: false,
92
- uppercase: false,
93
- lowercase: false,
94
- symbols: false,
95
- length: 16,
96
- ranges: [
97
- [[9800, 9807], [9818, 9823]], // Group of char range. Zodiac signs, chess figures.
98
- [[9698, 9701], [9606, 9611]], // Group of char range. Geometric figures
99
- ],
100
- });
101
- console.log(password); // Output "▋▆♟◥◢♎◥♚♞♚▆♚◥▆▉♝"
102
- ```
103
-
104
- The ranges option is array of UTF-8 char ranges.<br/>
105
- You can find all of them on [unicode table](https://unicode-table.com/ru/#box-drawing)
106
-
107
- Example above contains UTF-8 chars with codes from 9800 to 9807 and from 9818 to 9823 (zodiac signs and chess figures).<br/>
108
- The example also contains UTF-8 chars with codes from 9698 to 9701 and from 9606 to 9611 (geometric figures).
109
-
110
- This means that password will **necessarily** contain **one or more** chess figures **or** zodiac signs **and** one or more geometric figures.<br/>
111
- But it doesn't mean that password will contain zodiac signs **and** chess figures because they are part of one range.<br/>
112
- If you want make password with zodiac signs **and** chess figures you should move chess figures to new range.
113
-
114
- For example:
115
-
116
- ```javascript
117
- import passfather from 'passfather';
118
- const password = passfather({
119
- numbers: false,
120
- uppercase: false,
121
- lowercase: false,
122
- symbols: false,
123
- length: 16,
124
- ranges: [
125
- [[9800, 9807]], // Group of char range. Zodiac signs
126
- [[9818, 9823]], // Group of char range. Chess figures.
127
- [[9698, 9701], [9606, 9611]], // Group of char range. Geometric figures
128
- ],
129
- });
130
- console.log(password); // Output "♏◣♛◥♚♟♚♝♌▆♌♚♞▉♞♞"
131
- ```
132
-
133
- Making new range you get guarantee that one of char from range will be part of password.
134
-
135
- Ranges may using together with number, uppercase, lowercase or symbols option.
136
-
137
- For example:
138
-
139
- ```javascript
140
- import passfather from 'passfather';
141
- const password = passfather({
142
- // number, uppercase, lowercase or symbols enabled by default
143
- // so we just don't pass them.
144
- length: 16,
145
- ranges: [
146
- [[9800, 9807]],
147
- [[9818, 9823]],
148
- [[9698, 9701], [9606, 9611]],
149
- ],
150
- });
151
- console.log(password); // Output "♚!N◢♊q6DO1,3▉♌k5♞"
152
- ```
153
-
154
- ## Contributing
155
-
156
- See [contributing](https://github.com/vyushin/passfather/blob/master/CONTRIBUTING.md) guideline.
157
-
158
- ## License
159
- [MIT LICENSE](https://github.com/vyushin/passfather/blob/master/LICENSE)
1
+ # passfather
2
+ [![version](https://img.shields.io/npm/v/passfather.svg?style=flat-square)](https://www.npmjs.com/package/passfather)
3
+ [![license](https://img.shields.io/github/license/vyushin/passfather.svg?style=flat-square)](https://github.com/vyushin/passfather/blob/master/LICENSE)
4
+
5
+ **passfather** is very fast and powerful utility with zero dependencies to generate strong password or random string.
6
+
7
+ ## Table of contents
8
+ * [Features](#features)
9
+ * [Installation](#installation)
10
+ * [Example](#example)
11
+ * [Options](#options)
12
+ * [Contributing](#contributing)
13
+ * [Licence](#license)
14
+
15
+ ## Features
16
+
17
+ * Support browsers and Node.js;
18
+ * Multiple random number algorithmes such as Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03.
19
+ By default using [getRandomValues](https://developer.mozilla.org/ru/docs/Web/API/RandomSource/getRandomValues) for browsers and [getRandomBytes](https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback) for Node.js;
20
+ * Support seed with entropy;
21
+ * Optional using any of unicode chars (ranges). By default there are uppercase, lowercase, numbers and about ten symbols;
22
+ * Any length;
23
+
24
+ ## Installation
25
+
26
+ ###### NPM
27
+ `npm install --save passfather`
28
+
29
+ ###### Yarn
30
+ `yarn add passfather`
31
+
32
+ ###### ESM
33
+ ```html
34
+ <script type="module">
35
+ import passfather from 'https://unpkg.com/passfather@^3.0.0/dist/passfather.min.mjs'
36
+ console.log( passfather() ); // Output "vFR_@1hDMhAr"
37
+ </script>
38
+ ```
39
+
40
+ ###### UMD
41
+
42
+ ```html
43
+ <script src="https://unpkg.com/passfather@^3.0.0/dist/passfather.min.js"></script>
44
+ <script>
45
+ console.log( passfather() ); // Output "r_@1hDvFRMhA"
46
+ </script>
47
+ ```
48
+
49
+ ## Example
50
+
51
+ It's very easy! Just import **passfather** and run it.
52
+
53
+ ```javascript
54
+ import passfather from 'passfather';
55
+ const password = passfather();
56
+ console.log(password); // Output "9g'Jta75Gl3w"
57
+ ```
58
+
59
+ By default passfather doesn't require any options. But it's possible to pass options object to
60
+ customize password.
61
+
62
+ ```javascript
63
+ import passfather from 'passfather';
64
+ const password = passfather({
65
+ numbers: true,
66
+ uppercase: true,
67
+ lowercase: true,
68
+ symbols: false, // Disable symbols
69
+ length: 16,
70
+ });
71
+ console.log(password); // Output "40rAe2hqiM0UzTmN"
72
+ ```
73
+
74
+ **NOTE:** if option object is passed then it merges with default options object.
75
+
76
+ ## Options
77
+
78
+ |Name|Type|Default|Description
79
+ |---|---|---|---
80
+ |numbers|boolean|`true`|Enable/disable numbers
81
+ |uppercase|boolean|`true`|Enable/disable uppercase
82
+ |lowercase|boolean|`true`|Enable/disable lowercase
83
+ |symbols|boolean|`true`|Enable/disable symbols
84
+ |length|integer|`12`|Final string length
85
+ |prng|string|`default`|[Pseudorandom Number Generator](https://en.wikipedia.org/wiki/Pseudorandom_number_generator). Generating random string algorithm is using random numbers that generated by prng. Might be: default, Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03.
86
+ |seed|array|[seed.js](https://github.com/vyushin/passfather/blob/master/src/seed.js)|Seed for prng. See [random seed](https://en.wikipedia.org/wiki/Random_seed). NOTE: Default value doesn't have enough entropy. Please, using your own values.
87
+ |ranges|array|`null`|UTF-8 char ranges that will using to generate random string. See below.
88
+
89
+ ### Options: `ranges` (custom chars)
90
+
91
+ Passfather can make password containing custom chars.<br/>
92
+ It's possible via ranges option.
93
+
94
+ For example:
95
+
96
+ ```javascript
97
+ import passfather from 'passfather';
98
+ const password = passfather({
99
+ numbers: false,
100
+ uppercase: false,
101
+ lowercase: false,
102
+ symbols: false,
103
+ length: 16,
104
+ ranges: [
105
+ [[9800, 9807], [9818, 9823]], // Group of char range. Zodiac signs, chess figures.
106
+ [[9698, 9701], [9606, 9611]], // Group of char range. Geometric figures
107
+ ],
108
+ });
109
+ console.log(password); // Output "▋▆♟◥◢♎◥♚♞♚▆♚◥▆▉♝"
110
+ ```
111
+
112
+ The ranges option is array of UTF-8 char ranges.<br/>
113
+ You can find all of them on [unicode table](https://unicode-table.com/ru/#box-drawing)
114
+
115
+ Example above contains UTF-8 chars with codes from 9800 to 9807 and from 9818 to 9823 (zodiac signs and chess figures).<br/>
116
+ The example also contains UTF-8 chars with codes from 9698 to 9701 and from 9606 to 9611 (geometric figures).
117
+
118
+ This means that password will **necessarily** contain **one or more** chess figures **or** zodiac signs **and** one or more geometric figures.<br/>
119
+ But it doesn't mean that password will contain zodiac signs **and** chess figures because they are part of one range.<br/>
120
+ If you want make password with zodiac signs **and** chess figures you should move chess figures to new range.
121
+
122
+ For example:
123
+
124
+ ```javascript
125
+ import passfather from 'passfather';
126
+ const password = passfather({
127
+ numbers: false,
128
+ uppercase: false,
129
+ lowercase: false,
130
+ symbols: false,
131
+ length: 16,
132
+ ranges: [
133
+ [[9800, 9807]], // Group of char range. Zodiac signs
134
+ [[9818, 9823]], // Group of char range. Chess figures.
135
+ [[9698, 9701], [9606, 9611]], // Group of char range. Geometric figures
136
+ ],
137
+ });
138
+ console.log(password); // Output "♏◣♛◥♚♟♚♝♌▆♌♚♞▉♞♞"
139
+ ```
140
+
141
+ Making new range you get guarantee that one of char from range will be part of password.
142
+
143
+ Ranges may using together with number, uppercase, lowercase or symbols option.
144
+
145
+ For example:
146
+
147
+ ```javascript
148
+ import passfather from 'passfather';
149
+ const password = passfather({
150
+ // number, uppercase, lowercase or symbols enabled by default
151
+ // so we just don't pass them.
152
+ length: 16,
153
+ ranges: [
154
+ [[9800, 9807]],
155
+ [[9818, 9823]],
156
+ [[9698, 9701], [9606, 9611]],
157
+ ],
158
+ });
159
+ console.log(password); // Output "♚!N◢♊q6DO1,3▉♌k5♞"
160
+ ```
161
+
162
+ ## Contributing
163
+
164
+ See [contributing](https://github.com/vyushin/passfather/blob/master/CONTRIBUTING.md) guideline.
165
+
166
+ ## License
167
+ [MIT LICENSE](https://github.com/vyushin/passfather/blob/master/LICENSE)
@@ -1,16 +1,16 @@
1
- declare module "passfather" {
2
-
3
- export interface PassfatherOptions {
4
- numbers?: boolean | undefined;
5
- uppercase?: boolean | undefined;
6
- lowercase?: boolean | undefined;
7
- symbols?: boolean | undefined;
8
- length?: number | undefined;
9
- ranges?: Array<number[]> | undefined;
10
- prng?: 'default' | 'Alea' | 'KISS07' | 'Kybos' | 'LFib' | 'LFIB4' | 'MRG32k3a' | 'Xorshift03' | undefined;
11
- seed?: Array<string | number> | undefined;
12
- }
13
-
14
- export default function passfather(options?: PassfatherOptions): string;
15
-
16
- }
1
+ declare module "passfather" {
2
+
3
+ export interface PassfatherOptions {
4
+ numbers?: boolean | undefined;
5
+ uppercase?: boolean | undefined;
6
+ lowercase?: boolean | undefined;
7
+ symbols?: boolean | undefined;
8
+ length?: number | undefined;
9
+ ranges?: Array<number[]> | undefined;
10
+ prng?: 'default' | 'Alea' | 'KISS07' | 'Kybos' | 'LFib' | 'LFIB4' | 'MRG32k3a' | 'Xorshift03' | undefined;
11
+ seed?: Array<string | number> | undefined;
12
+ }
13
+
14
+ export default function passfather(options?: PassfatherOptions): string;
15
+
16
+ }