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 +19 -19
- package/README.md +167 -159
- package/dist/passfather.d.ts +16 -16
- package/dist/passfather.esm.js +407 -382
- package/dist/passfather.esm.min.js +1 -1
- package/dist/passfather.esm.min.js.LICENSE.txt +1 -1
- package/dist/passfather.js +261 -175
- package/dist/passfather.min.js +1 -1
- package/dist/passfather.min.js.LICENSE.txt +1 -1
- package/dist/passfather.min.mjs +1 -1
- package/dist/passfather.min.mjs.LICENSE.txt +1 -1
- package/dist/passfather.mjs +407 -382
- package/package.json +42 -41
- package/CHANGELOG.md +0 -32
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
|
-
[](https://www.npmjs.com/package/passfather)
|
|
3
|
-
[](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
|
-
##
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
######
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
# passfather
|
|
2
|
+
[](https://www.npmjs.com/package/passfather)
|
|
3
|
+
[](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)
|
package/dist/passfather.d.ts
CHANGED
|
@@ -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
|
+
}
|