passfather 3.0.3 → 3.0.4
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 +34 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# passfather
|
|
2
2
|
[](https://www.npmjs.com/package/passfather)
|
|
3
|
+
[](https://www.npmjs.com/package/passfather)
|
|
3
4
|
[](https://github.com/vyushin/passfather/blob/master/LICENSE)
|
|
4
5
|
|
|
5
|
-
**passfather** is very fast and powerful utility with zero dependencies to generate strong
|
|
6
|
+
**passfather** is a very fast and powerful utility with zero dependencies, designed to generate strong passwords or random strings.
|
|
6
7
|
|
|
7
8
|
## Table of contents
|
|
8
9
|
* [Features](#features)
|
|
@@ -14,12 +15,12 @@
|
|
|
14
15
|
|
|
15
16
|
## Features
|
|
16
17
|
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
By default
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
18
|
+
* Supports both browsers and Node.js.;
|
|
19
|
+
* Offers multiple random number algorithms such as Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03.
|
|
20
|
+
By default, it uses [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;
|
|
21
|
+
* Supports seeding with entropy;
|
|
22
|
+
* Optionally utilizes any Unicode characters;
|
|
23
|
+
* Allows for any password length.
|
|
23
24
|
|
|
24
25
|
## Installation
|
|
25
26
|
|
|
@@ -48,7 +49,7 @@ By default using [getRandomValues](https://developer.mozilla.org/ru/docs/Web/API
|
|
|
48
49
|
|
|
49
50
|
## Example
|
|
50
51
|
|
|
51
|
-
It's very easy! Just import **passfather** and run
|
|
52
|
+
It's very easy! Just import **passfather** and run the function.
|
|
52
53
|
|
|
53
54
|
```javascript
|
|
54
55
|
import passfather from 'passfather';
|
|
@@ -56,8 +57,7 @@ const password = passfather();
|
|
|
56
57
|
console.log(password); // Output "9g'Jta75Gl3w"
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
By default passfather
|
|
60
|
-
customize password.
|
|
60
|
+
By default, passfather does not require any options. However, it is possible to pass an options object to customize the password.
|
|
61
61
|
|
|
62
62
|
```javascript
|
|
63
63
|
import passfather from 'passfather';
|
|
@@ -71,7 +71,7 @@ const password = passfather({
|
|
|
71
71
|
console.log(password); // Output "40rAe2hqiM0UzTmN"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
**NOTE:**
|
|
74
|
+
**NOTE:** an options object is passed, it merges with the default options object.
|
|
75
75
|
|
|
76
76
|
## Options
|
|
77
77
|
|
|
@@ -82,14 +82,13 @@ console.log(password); // Output "40rAe2hqiM0UzTmN"
|
|
|
82
82
|
|lowercase|boolean|`true`|Enable/disable lowercase
|
|
83
83
|
|symbols|boolean|`true`|Enable/disable symbols
|
|
84
84
|
|length|integer|`12`|Final string length
|
|
85
|
-
|prng|string|`default`|[
|
|
86
|
-
|seed|array|[seed.js](https://github.com/vyushin/passfather/blob/master/src/seed.js)|Seed for
|
|
87
|
-
|ranges|array|`null`|UTF-8
|
|
85
|
+
|prng|string|`default`| The algorithm for generating random strings uses random numbers generated by a [pseudorandom number generator]((https://en.wikipedia.org/wiki/Pseudorandom_number_generator)) (PRNG). Options include default, Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, and Xorshift03. By default, it uses [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;
|
|
86
|
+
|seed|array|[seed.js](https://github.com/vyushin/passfather/blob/master/src/seed.js)|Seed for the PRNG. See [random seed](https://en.wikipedia.org/wiki/Random_seed) for details. NOTE: The default value may not have sufficient entropy. It is recommended to use your own values for better security.
|
|
87
|
+
|ranges|array|`null`|UTF-8 character ranges that will be used to generate the random string. See below for details.
|
|
88
88
|
|
|
89
|
-
### Options: `ranges` (custom
|
|
89
|
+
### Options: `ranges` (custom characters)
|
|
90
90
|
|
|
91
|
-
Passfather can
|
|
92
|
-
It's possible via ranges option.
|
|
91
|
+
Passfather can create passwords containing custom characters through the `ranges` option.
|
|
93
92
|
|
|
94
93
|
For example:
|
|
95
94
|
|
|
@@ -102,22 +101,23 @@ const password = passfather({
|
|
|
102
101
|
symbols: false,
|
|
103
102
|
length: 16,
|
|
104
103
|
ranges: [
|
|
105
|
-
[[9800, 9807], [9818, 9823]], // Group of
|
|
106
|
-
[[9698, 9701], [
|
|
104
|
+
[[9800, 9807], [9818, 9823]], // Group of character ranges including zodiac signs and chess figures
|
|
105
|
+
[[9698, 9701], [0x2586, 0x258B]], // Geometric figures
|
|
107
106
|
],
|
|
108
107
|
});
|
|
109
108
|
console.log(password); // Output "▋▆♟◥◢♎◥♚♞♚▆♚◥▆▉♝"
|
|
110
109
|
```
|
|
111
110
|
|
|
112
|
-
The ranges option is array of UTF-8
|
|
113
|
-
|
|
111
|
+
The `ranges` option is an array of UTF-8 character ranges<br/>
|
|
112
|
+
> Passfather supports a range from 0 to 65535 in the decimal system, and from 0x0000 to 0xFFFF in the hexadecimal system.<br/>
|
|
113
|
+
You can find all of them on the [unicode table](https://unicode-table.com/unicode-table)
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
The example above includes UTF-8 characters with codes ranging from 9800 to 9807 and from 9818 to 9823, which represent zodiac signs and chess figures.<br/>
|
|
116
|
+
It also includes characters with codes from 9698 to 9701 and from 0x2586 to 0x258B, representing geometric figures.
|
|
117
117
|
|
|
118
|
-
This
|
|
119
|
-
|
|
120
|
-
If you want
|
|
118
|
+
This implies that the password will **necessarily** contain **one or more** chess figures **or** zodiac signs **and** one or more geometric figures.<br/>
|
|
119
|
+
However, it does not mean that the password will contain both zodiac signs and chess figures, as they are part of the same range.<br/>
|
|
120
|
+
If you want to create a password that includes **both** zodiac signs **and** chess figures, you should move the chess figures to a new range.
|
|
121
121
|
|
|
122
122
|
For example:
|
|
123
123
|
|
|
@@ -130,30 +130,30 @@ const password = passfather({
|
|
|
130
130
|
symbols: false,
|
|
131
131
|
length: 16,
|
|
132
132
|
ranges: [
|
|
133
|
-
[[9800, 9807]], // Group of
|
|
134
|
-
[[9818, 9823]], //
|
|
135
|
-
[[9698, 9701], [
|
|
133
|
+
[[9800, 9807]], // Group of character ranges including zodiac signs
|
|
134
|
+
[[9818, 9823]], // Chess figures.
|
|
135
|
+
[[9698, 9701], [0x2586, 0x258B]], // Geometric figures
|
|
136
136
|
],
|
|
137
137
|
});
|
|
138
138
|
console.log(password); // Output "♏◣♛◥♚♟♚♝♌▆♌♚♞▉♞♞"
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
By creating a new range, you ensure that at least one character from that range will be part of the password.
|
|
142
142
|
|
|
143
|
-
Ranges
|
|
143
|
+
Ranges can be used in conjunction with the number, uppercase, lowercase, or symbols options.
|
|
144
144
|
|
|
145
145
|
For example:
|
|
146
146
|
|
|
147
147
|
```javascript
|
|
148
148
|
import passfather from 'passfather';
|
|
149
149
|
const password = passfather({
|
|
150
|
-
//
|
|
151
|
-
// so
|
|
150
|
+
// Number, uppercase, lowercase, and symbols are enabled by default,
|
|
151
|
+
// so there is no need to pass them separately
|
|
152
152
|
length: 16,
|
|
153
153
|
ranges: [
|
|
154
154
|
[[9800, 9807]],
|
|
155
155
|
[[9818, 9823]],
|
|
156
|
-
[[9698, 9701], [
|
|
156
|
+
[[9698, 9701], [0x2586, 0x258B]],
|
|
157
157
|
],
|
|
158
158
|
});
|
|
159
159
|
console.log(password); // Output "♚!N◢♊q6DO1,3▉♌k5♞"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passfather",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Passfather is very fast and powerful utility with zero dependencies to generate strong password",
|
|
5
5
|
"author": "Evgeny Vyushin <e@vyushin.ru> (https://github.com/vyushin)",
|
|
6
6
|
"contributors": [
|