@sebastienrousseau/jspassgen-cli 0.0.0-stage → 0.0.23
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-APACHE +190 -0
- package/LICENSE-MIT +21 -0
- package/README.md +307 -2
- package/bin/jspassgen.js +6 -0
- package/package.json +90 -4
- package/src/cli.js +75 -0
- package/src/generate.js +29 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Sebastien Rousseau
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastien Rousseau
|
|
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
CHANGED
|
@@ -1,3 +1,308 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/sebastienrousseau/jspassgen/main/.github/assets/logo.svg" alt="jspassgen logo" width="128" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">jspassgen-cli</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
The jspassgen command line: it generates passwords on your machine from the platform CSPRNG, with all generation done by the @sebastienrousseau/jspassgen library.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://github.com/sebastienrousseau/jspassgen-cli/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/jspassgen-cli/ci.yml?style=for-the-badge&logo=github" alt="Build" height="28" /></a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@sebastienrousseau/jspassgen-cli"><img src="https://img.shields.io/npm/v/@sebastienrousseau/jspassgen-cli?style=for-the-badge&color=fc8d62&logo=npm" alt="Registry" height="28" /></a>
|
|
16
|
+
<a href="https://github.com/sebastienrousseau/jspassgen-cli/blob/main/DEVELOPMENT.md"><img src="https://img.shields.io/badge/docs-development-blue?style=for-the-badge&labelColor=555555&logo=readthedocs" alt="Docs" height="28" /></a>
|
|
17
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/sebastienrousseau/jspassgen-cli"><img src="https://img.shields.io/ossf-scorecard/github.com/sebastienrousseau/jspassgen-cli?style=for-the-badge&label=OpenSSF%20Scorecard&logo=openssf" alt="OpenSSF Scorecard" height="28" /></a>
|
|
18
|
+
<a href="LICENSE-APACHE"><img src="https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg?style=for-the-badge" alt="License: Apache-2.0 OR MIT" height="28" /></a>
|
|
19
|
+
<a href="#requirements"><img src="https://img.shields.io/badge/Node.js-22.12%2B-93450a.svg?style=for-the-badge&logo=node.js" alt="Node.js 22.12 or newer" height="28" /></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<img src="https://raw.githubusercontent.com/sebastienrousseau/jspassgen-cli/main/.github/demo.gif" alt="The jspassgen bin from a checkout: it prints its version, generates a strong password of four 16-character chunks, then one of three 12-character chunks separated by dots" width="100%" />
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Contents
|
|
29
|
+
|
|
30
|
+
**Getting started**
|
|
31
|
+
|
|
32
|
+
- [Install](#install): global install, `npx`, or a checkout
|
|
33
|
+
- [Requirements](#requirements): Node.js floor, platforms, dependencies
|
|
34
|
+
- [Quick Start](#quick-start): print the version and generate a password
|
|
35
|
+
|
|
36
|
+
**The jspassgen ecosystem**
|
|
37
|
+
|
|
38
|
+
- [The jspassgen ecosystem](#the-jspassgen-ecosystem): the core library, its tools, native SDKs and site
|
|
39
|
+
|
|
40
|
+
**Library reference**
|
|
41
|
+
|
|
42
|
+
- [Capabilities at a glance](#capabilities-at-a-glance): what the bin does today, and what it does not yet
|
|
43
|
+
- [Ecosystem comparison](#ecosystem-comparison): this bin against the one inside jspassgen
|
|
44
|
+
- [Benchmarks](#benchmarks): none, and why
|
|
45
|
+
- [Features](#features): the current surface
|
|
46
|
+
- [Configuration](#configuration): the `generate` options
|
|
47
|
+
- [Examples](#examples): command lines
|
|
48
|
+
|
|
49
|
+
**Operational**
|
|
50
|
+
|
|
51
|
+
- [When not to use jspassgen-cli](#when-not-to-use-jspassgen-cli): limitations
|
|
52
|
+
- [Development](#development): make targets and CI
|
|
53
|
+
- [Security](#security): randomness, network and data handling
|
|
54
|
+
- [Documentation](#documentation): all reference docs
|
|
55
|
+
- [Stability guarantees](#stability-guarantees): version axis and toolchain floor
|
|
56
|
+
- [License](#license)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
### As a JavaScript library
|
|
63
|
+
|
|
64
|
+
This package is a command line, not a library: it exports no API, and
|
|
65
|
+
programs should depend on
|
|
66
|
+
[`@sebastienrousseau/jspassgen`](https://www.npmjs.com/package/@sebastienrousseau/jspassgen)
|
|
67
|
+
directly.
|
|
68
|
+
|
|
69
|
+
### As a command line
|
|
70
|
+
|
|
71
|
+
Install the `jspassgen` command globally, or run it once without
|
|
72
|
+
installing:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @sebastienrousseau/jspassgen-cli
|
|
76
|
+
npx @sebastienrousseau/jspassgen-cli generate
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`@sebastienrousseau/jspassgen` also installs a bin named `jspassgen`;
|
|
80
|
+
install only one of the two globally.
|
|
81
|
+
|
|
82
|
+
Run the bin from a checkout:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/sebastienrousseau/jspassgen-cli.git
|
|
86
|
+
cd jspassgen-cli
|
|
87
|
+
npm ci
|
|
88
|
+
node bin/jspassgen.js --version
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Requirements
|
|
94
|
+
|
|
95
|
+
- Node.js 22.12 or newer (`engines` in `package.json`), the floor that
|
|
96
|
+
`commander` 15 declares.
|
|
97
|
+
- CI runs the tests on Node.js 22 and 24 on Ubuntu 24.04. The code is
|
|
98
|
+
plain ESM JavaScript with no native modules.
|
|
99
|
+
- Run-time dependencies: `@sebastienrousseau/jspassgen`, pinned to
|
|
100
|
+
exactly 0.0.23, the suite version, and `commander`.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Quick Start
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
jspassgen --version
|
|
108
|
+
jspassgen generate
|
|
109
|
+
jspassgen generate --length 12 --iteration 3 --separator .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--version` prints this package's version. `generate` prints one strong
|
|
113
|
+
password: `--iteration` chunks of `--length` base64 characters (16 and 4
|
|
114
|
+
by default), joined by `--separator` (`-` by default). The characters
|
|
115
|
+
come from the library's strong generator over Node.js `crypto`; the CLI
|
|
116
|
+
only parses arguments and prints the result. An option the library
|
|
117
|
+
rejects (for example `--length 0`) prints the library's message on
|
|
118
|
+
standard error and exits with status 1.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## The jspassgen ecosystem
|
|
123
|
+
|
|
124
|
+
jspassgen is one core library and the tools, SDKs and site around it.
|
|
125
|
+
Every member is listed in
|
|
126
|
+
[`docs/ecosystem.json`](https://github.com/sebastienrousseau/jspassgen/blob/main/docs/ecosystem.json)
|
|
127
|
+
and, from the suite's first lockstep release, every member ships the same
|
|
128
|
+
version ([ADR 0001](https://github.com/sebastienrousseau/jspassgen/blob/main/docs/adr/0001-ecosystem-lockstep.md)).
|
|
129
|
+
The JavaScript tools depend on the core and add no generation logic of
|
|
130
|
+
their own; each SDK is a native port that is checked against the core's
|
|
131
|
+
conformance kit as its generators land.
|
|
132
|
+
|
|
133
|
+
| Component | Purpose | Use case |
|
|
134
|
+
| :---------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- | :---------------------------------------------- |
|
|
135
|
+
| [`jspassgen`](https://github.com/sebastienrousseau/jspassgen) | Password and passphrase core, Node.js library, CLI, web UI and workers; source of the conformance kit | Programs that generate secrets |
|
|
136
|
+
| **`jspassgen-cli`** | Command-line generator built on the core | Passwords in a terminal or a script |
|
|
137
|
+
| [`jspassgen-mcp`](https://github.com/sebastienrousseau/jspassgen-mcp) | Local stdio MCP server | AI agents that need a generated secret |
|
|
138
|
+
| [`jspassgen-lsp`](https://github.com/sebastienrousseau/jspassgen-lsp) | Language server for weak literal secrets | Editors checking configuration and `.env` files |
|
|
139
|
+
| [`jspassgen-sdk-python`](https://github.com/sebastienrousseau/jspassgen-sdk-python) | Native port on the `secrets` module | Python programs |
|
|
140
|
+
| [`jspassgen-sdk-rust`](https://github.com/sebastienrousseau/jspassgen-sdk-rust) | Native port on the OS CSPRNG | Rust programs |
|
|
141
|
+
| [`jspassgen-sdk-java`](https://github.com/sebastienrousseau/jspassgen-sdk-java) | Native port on `SecureRandom` | JVM programs |
|
|
142
|
+
| [`jspassgen-sdk-dotnet`](https://github.com/sebastienrousseau/jspassgen-sdk-dotnet) | Native port on `RandomNumberGenerator` | .NET programs |
|
|
143
|
+
| [`jspassgen-sdk-cpp`](https://github.com/sebastienrousseau/jspassgen-sdk-cpp) | Native C++17 port on the OS CSPRNG | C++ programs |
|
|
144
|
+
| [`jspassgen.github.io`](https://github.com/sebastienrousseau/jspassgen.github.io) | Source of [jspassgen.com](https://jspassgen.com) | Evaluating the suite |
|
|
145
|
+
|
|
146
|
+
Every member ships at 0.0.23, the suite's second lockstep release: the
|
|
147
|
+
core, CLI, MCP and LSP servers on npm, the Python, Rust, Java and .NET
|
|
148
|
+
SDKs on PyPI, crates.io, Maven Central and NuGet, and the C++ SDK and
|
|
149
|
+
the site as GitHub releases. The table gives each member's purpose, and
|
|
150
|
+
each README's Capabilities at a glance says what works today.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Capabilities at a glance
|
|
155
|
+
|
|
156
|
+
| Area | Capability | Status |
|
|
157
|
+
| :----------------------------------------- | :------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
|
|
158
|
+
| Version | `--version` | Available |
|
|
159
|
+
| Generation | `generate`: strong password (base64 characters, chunks, separator) | Available |
|
|
160
|
+
| Other password types | base64, memorable, diceware, quantum-resistant, honeyword, pronounceable, custom | Not available yet; in the jspassgen bin today |
|
|
161
|
+
| Entropy and strength | Entropy report, strength analysis | Not available yet |
|
|
162
|
+
| Presets, clipboard, interactive onboarding | The rest of jspassgen's `src/cli` | Not available yet; moves here in a later version |
|
|
163
|
+
| Distribution | npm package, release archives, `SHA256SUMS` | Available from 0.0.22: the npm package, and the GitHub release with the tarball and `SHA256SUMS` |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Ecosystem comparison
|
|
168
|
+
|
|
169
|
+
Today the full command line still lives in jspassgen. This repository is
|
|
170
|
+
where it moves: when it ships, the `jspassgen` bin in the core package
|
|
171
|
+
becomes a shim that names this package, and is removed one release later
|
|
172
|
+
(ADR 0001).
|
|
173
|
+
|
|
174
|
+
| Project | Password types | Published on npm | Generation code |
|
|
175
|
+
| :------------------------------------------------ | :----------------------: | :--------------: | :----------------------: |
|
|
176
|
+
| **jspassgen-cli** | **Strong only, for now** | **Yes (0.0.22)** | **None; calls the core** |
|
|
177
|
+
| `jspassgen` bin in `@sebastienrousseau/jspassgen` | All eight | Yes (0.0.22) | In the same package |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Benchmarks
|
|
182
|
+
|
|
183
|
+
None are published. The CLI does no generation of its own, so a
|
|
184
|
+
benchmark here would measure Node.js start-up and the core library; the
|
|
185
|
+
core's benchmarks live in
|
|
186
|
+
[jspassgen](https://github.com/sebastienrousseau/jspassgen).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Features
|
|
191
|
+
|
|
192
|
+
- One command, `generate`, prints a strong password from the library's
|
|
193
|
+
`strong` type, with `--length`, `--iteration` and `--separator`.
|
|
194
|
+
- `--version` prints the version from `package.json`.
|
|
195
|
+
- `--length` and `--iteration` accept whole numbers only; anything else
|
|
196
|
+
is a usage error before the library is called.
|
|
197
|
+
- Validation (lengths from 1 to 1024, at least one chunk) is the
|
|
198
|
+
library's, and so are its error messages.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Configuration
|
|
203
|
+
|
|
204
|
+
`jspassgen generate` options:
|
|
205
|
+
|
|
206
|
+
| Option | Default | Meaning |
|
|
207
|
+
| :----------------------- | :------ | :------------------------------ |
|
|
208
|
+
| `-l, --length <n>` | 16 | Characters per chunk, 1 to 1024 |
|
|
209
|
+
| `-i, --iteration <n>` | 4 | Number of chunks, at least 1 |
|
|
210
|
+
| `-s, --separator <text>` | `-` | Text between chunks |
|
|
211
|
+
|
|
212
|
+
The CLI reads no configuration file and no environment variable.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Examples
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# A 64-character password in four chunks: the defaults
|
|
220
|
+
jspassgen generate
|
|
221
|
+
|
|
222
|
+
# One chunk of 32 characters, no separator needed
|
|
223
|
+
jspassgen generate --length 32 --iteration 1
|
|
224
|
+
|
|
225
|
+
# Into a shell variable, without echoing it
|
|
226
|
+
secret="$(jspassgen generate)"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## When not to use jspassgen-cli
|
|
232
|
+
|
|
233
|
+
- You need anything but a strong password today. Passphrases, memorable
|
|
234
|
+
passwords and the other types are in the jspassgen bin until the CLI
|
|
235
|
+
moves here.
|
|
236
|
+
- You are writing a program. Depend on `@sebastienrousseau/jspassgen`
|
|
237
|
+
and call its API; spawning a CLI to get a secret adds a process and a
|
|
238
|
+
pipe for nothing.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Development
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
mise install # Node.js 24 (mise.toml)
|
|
246
|
+
make check # npm ci, eslint, prettier, the tests at 100% coverage
|
|
247
|
+
make audit # npm audit over every locked dependency
|
|
248
|
+
make demo # re-render .github/demo.gif with vhs
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`make check` is the local gate. CI runs the same targets, the tests on
|
|
252
|
+
Node.js 22 and 24, plus shellcheck, CodeQL, the DCO check, markdownlint,
|
|
253
|
+
the README template check, codespell, REUSE and offline link checks.
|
|
254
|
+
The demo needs [VHS](https://github.com/charmbracelet/vhs).
|
|
255
|
+
[`DEVELOPMENT.md`](DEVELOPMENT.md) maps every CI gate to its command.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Security
|
|
260
|
+
|
|
261
|
+
Randomness comes from the library's Node.js adapter, which uses
|
|
262
|
+
`crypto.randomInt` and `crypto.randomBytes`; this package has no random
|
|
263
|
+
source of its own and never uses `Math.random()`. The CLI makes no
|
|
264
|
+
network call, sends no telemetry and writes no file: the password goes
|
|
265
|
+
to standard output only. A test fails if `bin/` or `src/` imports a
|
|
266
|
+
network module. Dependencies are audited with `npm audit` in CI, and
|
|
267
|
+
advisories are constrained in `package.json` `overrides`.
|
|
268
|
+
|
|
269
|
+
Report vulnerabilities according to [`SECURITY.md`](SECURITY.md).
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Documentation
|
|
274
|
+
|
|
275
|
+
- [Developer documentation](DEVELOPMENT.md)
|
|
276
|
+
- [Changelog](CHANGELOG.md)
|
|
277
|
+
- [Contributing](CONTRIBUTING.md)
|
|
278
|
+
- [Governance](GOVERNANCE.md)
|
|
279
|
+
- [Support](SUPPORT.md)
|
|
280
|
+
- [Security policy](SECURITY.md)
|
|
281
|
+
- [Agent rules](AGENTS.md)
|
|
282
|
+
- [Ecosystem ADR](https://github.com/sebastienrousseau/jspassgen/blob/main/docs/adr/0001-ecosystem-lockstep.md)
|
|
283
|
+
|
|
284
|
+
No user manual or API reference is published yet: the package has one
|
|
285
|
+
command and no API.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Stability guarantees
|
|
290
|
+
|
|
291
|
+
- The project is pre-1.0 and versions advance in `0.0.1` steps, in
|
|
292
|
+
lockstep with the jspassgen suite from its first release.
|
|
293
|
+
- The breaking axis is the command line. A removed or renamed command or
|
|
294
|
+
option, a changed default, or a different output format for the same
|
|
295
|
+
options is breaking, and the changelog calls it out.
|
|
296
|
+
- Passwords are random, so their values are not part of the contract;
|
|
297
|
+
their shape (alphabet, chunk count and length, separator) is.
|
|
298
|
+
- The core version is pinned exactly, so a release of this package
|
|
299
|
+
always runs the generator it was tested with.
|
|
300
|
+
- The Node.js floor is 22.12 (`engines`). It is raised only in a new
|
|
301
|
+
version, recorded in the changelog.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
Licensed under either [Apache License 2.0](LICENSE-APACHE) or
|
|
308
|
+
[MIT](LICENSE-MIT), at your option.
|
package/bin/jspassgen.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebastienrousseau/jspassgen-cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.23",
|
|
4
|
+
"description": "Command-line password generator built on @sebastienrousseau/jspassgen: strong passwords from the platform CSPRNG, made on your machine.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"command-line",
|
|
8
|
+
"jspassgen",
|
|
9
|
+
"password",
|
|
10
|
+
"password-generator",
|
|
11
|
+
"csprng",
|
|
12
|
+
"security"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/sebastienrousseau/jspassgen-cli#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/sebastienrousseau/jspassgen-cli/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/sebastienrousseau/jspassgen-cli.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0 OR MIT",
|
|
23
|
+
"author": "Sebastien Rousseau <sebastienrousseau@users.noreply.github.com>",
|
|
24
|
+
"funding": [
|
|
25
|
+
{
|
|
26
|
+
"type": "github",
|
|
27
|
+
"url": "https://github.com/sponsors/sebastienrousseau"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"bin": {
|
|
32
|
+
"jspassgen": "bin/jspassgen.js"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin/",
|
|
39
|
+
"src/",
|
|
40
|
+
"LICENSE-APACHE",
|
|
41
|
+
"LICENSE-MIT"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22.12.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"lint": "eslint .",
|
|
48
|
+
"format": "prettier --write .",
|
|
49
|
+
"format:check": "prettier --check .",
|
|
50
|
+
"test": "c8 mocha"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@sebastienrousseau/jspassgen": "0.0.23",
|
|
54
|
+
"commander": "^15.1.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint/js": "^10.0.1",
|
|
58
|
+
"c8": "^12.0.0",
|
|
59
|
+
"eslint": "^10.15.0",
|
|
60
|
+
"eslint-plugin-sonarjs": "^4.2.2",
|
|
61
|
+
"fast-check": "^4.10.2",
|
|
62
|
+
"globals": "^17.14.0",
|
|
63
|
+
"mocha": "^12.0.3",
|
|
64
|
+
"prettier": "^3.10.1"
|
|
65
|
+
},
|
|
66
|
+
"mocha": {
|
|
67
|
+
"spec": [
|
|
68
|
+
"test/**/*.test.js"
|
|
69
|
+
],
|
|
70
|
+
"timeout": 20000
|
|
71
|
+
},
|
|
72
|
+
"c8": {
|
|
73
|
+
"all": true,
|
|
74
|
+
"include": [
|
|
75
|
+
"bin/**",
|
|
76
|
+
"src/**"
|
|
77
|
+
],
|
|
78
|
+
"reporter": [
|
|
79
|
+
"text",
|
|
80
|
+
"lcov"
|
|
81
|
+
],
|
|
82
|
+
"check-coverage": true,
|
|
83
|
+
"lines": 100,
|
|
84
|
+
"functions": 100,
|
|
85
|
+
"branches": 100,
|
|
86
|
+
"statements": 100
|
|
87
|
+
},
|
|
88
|
+
"overrides": {
|
|
89
|
+
"glob": "^14.0.2",
|
|
90
|
+
"minimatch": "^11.0.1"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The `jspassgen` command line: argument parsing and output only.
|
|
5
|
+
*
|
|
6
|
+
* @module cli
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { Command, InvalidArgumentError } from "commander";
|
|
11
|
+
import { generateStrong } from "./generate.js";
|
|
12
|
+
|
|
13
|
+
const { version } = JSON.parse(
|
|
14
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Parses a decimal integer option value, refusing anything else.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} value - The raw option value.
|
|
21
|
+
* @returns {number} The integer.
|
|
22
|
+
* @throws {InvalidArgumentError} When the value is not a whole number.
|
|
23
|
+
*/
|
|
24
|
+
export function parseInteger(value) {
|
|
25
|
+
if (!/^\d+$/.test(value)) {
|
|
26
|
+
throw new InvalidArgumentError("Not a whole number.");
|
|
27
|
+
}
|
|
28
|
+
return Number(value);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Builds the program.
|
|
33
|
+
*
|
|
34
|
+
* @param {{write: (text: string) => void}} out - Where passwords go.
|
|
35
|
+
* @returns {Command} The configured commander program.
|
|
36
|
+
*/
|
|
37
|
+
export function buildProgram(out) {
|
|
38
|
+
const program = new Command();
|
|
39
|
+
program
|
|
40
|
+
.name("jspassgen")
|
|
41
|
+
.description(
|
|
42
|
+
"Generate passwords on this machine with @sebastienrousseau/jspassgen.",
|
|
43
|
+
)
|
|
44
|
+
.version(version)
|
|
45
|
+
.showHelpAfterError();
|
|
46
|
+
|
|
47
|
+
program
|
|
48
|
+
.command("generate")
|
|
49
|
+
.description("generate a strong password from the platform CSPRNG")
|
|
50
|
+
.option("-l, --length <n>", "characters per chunk", parseInteger, 16)
|
|
51
|
+
.option("-i, --iteration <n>", "number of chunks", parseInteger, 4)
|
|
52
|
+
.option("-s, --separator <text>", "text between chunks", "-")
|
|
53
|
+
.action(async (options) => {
|
|
54
|
+
out.write(`${await generateStrong(options)}\n`);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return program;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Runs the program and turns a library error into a message and exit
|
|
62
|
+
* code 1. Commander handles its own usage errors.
|
|
63
|
+
*
|
|
64
|
+
* @param {string[]} argv - The full process.argv.
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
*/
|
|
67
|
+
export async function run(argv) {
|
|
68
|
+
const program = buildProgram(process.stdout);
|
|
69
|
+
try {
|
|
70
|
+
await program.parseAsync(argv);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
process.stderr.write(`error: ${error.message}\n`);
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/generate.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Password generation, delegated entirely to @sebastienrousseau/jspassgen.
|
|
5
|
+
*
|
|
6
|
+
* This module adds no generation logic of its own: it builds the core
|
|
7
|
+
* service with the library's Node.js CSPRNG adapter (crypto.randomInt and
|
|
8
|
+
* crypto.randomBytes) and passes the options through.
|
|
9
|
+
*
|
|
10
|
+
* @module generate
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createService } from "@sebastienrousseau/jspassgen/core";
|
|
14
|
+
import { NodeCryptoRandom } from "@sebastienrousseau/jspassgen/adapters/node";
|
|
15
|
+
|
|
16
|
+
const service = createService({}, { randomGenerator: new NodeCryptoRandom() });
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Generates a strong password: base64 characters from the platform
|
|
20
|
+
* CSPRNG, in `iteration` chunks of `length` characters joined by
|
|
21
|
+
* `separator`.
|
|
22
|
+
*
|
|
23
|
+
* @param {{length: number, iteration: number, separator: string}} options
|
|
24
|
+
* @returns {Promise<string>} The password.
|
|
25
|
+
* @throws {Error} When the library rejects the options.
|
|
26
|
+
*/
|
|
27
|
+
export function generateStrong({ length, iteration, separator }) {
|
|
28
|
+
return service.generate({ type: "strong", length, iteration, separator });
|
|
29
|
+
}
|