jspassgen 0.0.22__tar.gz
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.
- jspassgen-0.0.22/.gitignore +25 -0
- jspassgen-0.0.22/CHANGELOG.md +33 -0
- jspassgen-0.0.22/LICENSE-APACHE +190 -0
- jspassgen-0.0.22/LICENSE-MIT +21 -0
- jspassgen-0.0.22/PKG-INFO +321 -0
- jspassgen-0.0.22/README.md +293 -0
- jspassgen-0.0.22/pyproject.toml +115 -0
- jspassgen-0.0.22/src/jspassgen/__init__.py +19 -0
- jspassgen-0.0.22/src/jspassgen/adapters.py +76 -0
- jspassgen-0.0.22/src/jspassgen/ports.py +43 -0
- jspassgen-0.0.22/src/jspassgen/py.typed +0 -0
- jspassgen-0.0.22/tests/__init__.py +0 -0
- jspassgen-0.0.22/tests/test_package.py +50 -0
- jspassgen-0.0.22/tests/test_random.py +175 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
2
|
+
# Python bytecode, virtual environments and tool caches
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
.venv/
|
|
6
|
+
.mypy_cache/
|
|
7
|
+
.ruff_cache/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.hypothesis/
|
|
10
|
+
.coverage
|
|
11
|
+
.coverage.*
|
|
12
|
+
coverage.xml
|
|
13
|
+
htmlcov/
|
|
14
|
+
# Build output
|
|
15
|
+
build/
|
|
16
|
+
dist/
|
|
17
|
+
*.egg-info/
|
|
18
|
+
# Generated by `make docs`
|
|
19
|
+
site/
|
|
20
|
+
# Editors and OS
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
23
|
+
.DS_Store
|
|
24
|
+
# pip-audit input written by `make audit`
|
|
25
|
+
.audit-requirements.txt
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
|
|
2
|
+
|
|
3
|
+
# Changelog
|
|
4
|
+
|
|
5
|
+
All notable changes to this project are recorded here. The format follows
|
|
6
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions
|
|
7
|
+
advance in `0.0.1` steps in lockstep with the jspassgen suite.
|
|
8
|
+
|
|
9
|
+
## [0.0.22] - 2026-11-18
|
|
10
|
+
|
|
11
|
+
The repository's first version, released as the first jspassgen suite
|
|
12
|
+
release.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `RandomGeneratorPort`, the Python form of the core's random port:
|
|
17
|
+
`random_bytes(n)` and `random_int(max)`.
|
|
18
|
+
- `SecretsRandom`, the port on the `secrets` module, with `random_int`
|
|
19
|
+
unbiased by rejection sampling; `TypeError` for a non-`int` argument,
|
|
20
|
+
`ValueError` for one below 1.
|
|
21
|
+
- Tests for range, uniformity (chi-squared), the absence of modulo bias,
|
|
22
|
+
the rejection loop and every error; a test that the library imports
|
|
23
|
+
nothing that reaches the network and not `random`.
|
|
24
|
+
- The repository standard: `make check` gate, CI on Python 3.11 to 3.14,
|
|
25
|
+
CodeQL, DCO, docs lint (markdownlint, codespell, REUSE, links), OpenSSF
|
|
26
|
+
Scorecard, Dependabot, community files and the manual in `docs/`.
|
|
27
|
+
- The release workflow (`.github/workflows/release.yml`), run on a
|
|
28
|
+
pushed `v*` tag: it refuses a tag that is not annotated and signed,
|
|
29
|
+
not on the checked-out commit, or whose message or version does not
|
|
30
|
+
match `pyproject.toml`; runs `make check` and `make audit`; builds the
|
|
31
|
+
sdist and wheel with `SHA256SUMS`; publishes to PyPI through trusted
|
|
32
|
+
publishing behind the `pypi` environment; and drafts the GitHub
|
|
33
|
+
release with the files and checksums.
|
|
@@ -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.
|
|
@@ -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.
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: jspassgen
|
|
3
|
+
Version: 0.0.22
|
|
4
|
+
Summary: Native Python port of the jspassgen password and passphrase core, on the secrets module (in development).
|
|
5
|
+
Project-URL: Homepage, https://jspassgen.com
|
|
6
|
+
Project-URL: Repository, https://github.com/sebastienrousseau/jspassgen-sdk-python
|
|
7
|
+
Project-URL: Documentation, https://github.com/sebastienrousseau/jspassgen-sdk-python#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/sebastienrousseau/jspassgen-sdk-python/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/sebastienrousseau/jspassgen-sdk-python/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Sebastien Rousseau
|
|
11
|
+
License-Expression: Apache-2.0 OR MIT
|
|
12
|
+
License-File: LICENSE-APACHE
|
|
13
|
+
License-File: LICENSE-MIT
|
|
14
|
+
Keywords: csprng,generator,jspassgen,passphrase,password,secrets
|
|
15
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Security
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
<!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="https://raw.githubusercontent.com/sebastienrousseau/jspassgen/main/.github/assets/logo.svg" alt="jspassgen logo" width="128" />
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<h1 align="center">jspassgen-sdk-python</h1>
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
A native Python port of the jspassgen password and passphrase core that draws randomness only from the operating system's CSPRNG through the secrets module; this version ships the random port, not the generators.
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://github.com/sebastienrousseau/jspassgen-sdk-python/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/jspassgen-sdk-python/ci.yml?style=for-the-badge&logo=github" alt="Build" height="28" /></a>
|
|
43
|
+
<a href="https://pypi.org/project/jspassgen/"><img src="https://img.shields.io/pypi/v/jspassgen?style=for-the-badge&color=fc8d62&logo=pypi&logoColor=white" alt="PyPI version" height="28" /></a>
|
|
44
|
+
<a href="https://github.com/sebastienrousseau/jspassgen-sdk-python/tree/main/docs"><img src="https://img.shields.io/badge/docs-manual-blue?style=for-the-badge&labelColor=555555&logo=readthedocs" alt="Docs" height="28" /></a>
|
|
45
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/sebastienrousseau/jspassgen-sdk-python"><img src="https://img.shields.io/ossf-scorecard/github.com/sebastienrousseau/jspassgen-sdk-python?style=for-the-badge&label=OpenSSF%20Scorecard&logo=openssf" alt="OpenSSF Scorecard" height="28" /></a>
|
|
46
|
+
<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>
|
|
47
|
+
<a href="https://github.com/sebastienrousseau/jspassgen-sdk-python/blob/main/docs/POLICIES.md"><img src="https://img.shields.io/badge/Python-3.11%2B-93450a.svg?style=for-the-badge&logo=python&logoColor=white" alt="Python 3.11 or newer" height="28" /></a>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<em>No demo yet: there is nothing to show until the generators are ported. The demo will record real generated passwords, not a mock-up.</em>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Contents
|
|
57
|
+
|
|
58
|
+
**Getting started**
|
|
59
|
+
|
|
60
|
+
- [Install](#install): from PyPI with pip
|
|
61
|
+
- [Requirements](#requirements): Python floor, platforms
|
|
62
|
+
- [Quick Start](#quick-start): draw unbiased integers and bytes from the CSPRNG
|
|
63
|
+
|
|
64
|
+
**The jspassgen ecosystem**
|
|
65
|
+
|
|
66
|
+
- [The jspassgen ecosystem](#the-jspassgen-ecosystem): the core, its tools and the native SDKs, one version
|
|
67
|
+
|
|
68
|
+
**Library reference**
|
|
69
|
+
|
|
70
|
+
- [Capabilities at a glance](#capabilities-at-a-glance): what exists today and what is planned
|
|
71
|
+
- [Ecosystem comparison](#ecosystem-comparison): not written yet, and why
|
|
72
|
+
- [Benchmarks](#benchmarks): none yet, and why
|
|
73
|
+
- [Features](#features): module-level capability list
|
|
74
|
+
- [Configuration](#configuration): injecting a random port
|
|
75
|
+
- [Examples](#examples): none yet, and why
|
|
76
|
+
|
|
77
|
+
**Operational**
|
|
78
|
+
|
|
79
|
+
- [When not to use jspassgen-sdk-python](#when-not-to-use-jspassgen-sdk-python): limitations
|
|
80
|
+
- [Development](#development): make targets, CI
|
|
81
|
+
- [Security](#security): guarantees and reporting
|
|
82
|
+
- [Documentation](#documentation): all reference docs
|
|
83
|
+
- [Stability guarantees](#stability-guarantees): version axis, output contract, Python floor
|
|
84
|
+
- [License](#license)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
### As a Python library
|
|
91
|
+
|
|
92
|
+
`release.yml` publishes each signed tag to PyPI through trusted
|
|
93
|
+
publishing. Install 0.0.22, the first release, with pip:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install jspassgen==0.0.22
|
|
97
|
+
python -c 'import jspassgen; print(jspassgen.__version__)'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This version ships the random port and its `secrets` adapter; the
|
|
101
|
+
generators come in a later version.
|
|
102
|
+
|
|
103
|
+
The distribution and the import package are both `jspassgen`. The
|
|
104
|
+
package has no run-time dependencies, ships type information (PEP 561,
|
|
105
|
+
`py.typed`) and is checked with `mypy --strict`.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Requirements
|
|
110
|
+
|
|
111
|
+
- Python 3.11 or newer (`requires-python = ">=3.11"`).
|
|
112
|
+
- CI tests Python 3.11, 3.12, 3.13 and 3.14 on Ubuntu 24.04.
|
|
113
|
+
- Pure Python, standard library only. Randomness comes from `secrets`,
|
|
114
|
+
which reads the operating system's CSPRNG through `os.urandom`.
|
|
115
|
+
|
|
116
|
+
The floor rises only when a Python version reaches its end of life, as
|
|
117
|
+
the [toolchain policy](docs/POLICIES.md) describes.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Quick Start
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from jspassgen import SecretsRandom
|
|
125
|
+
|
|
126
|
+
rng = SecretsRandom()
|
|
127
|
+
print(rng.random_int(6) + 1) # a fair die roll, 1 to 6
|
|
128
|
+
print(rng.random_bytes(16).hex()) # 16 bytes from the OS CSPRNG
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`random_int(max)` returns an integer in `[0, max)` with every value
|
|
132
|
+
equally likely. It draws the bit length of `max - 1` and rejects any draw
|
|
133
|
+
of `max` or more, rather than reducing raw bytes modulo `max`, which
|
|
134
|
+
would favour the low values. Both methods refuse an argument below 1 with
|
|
135
|
+
`ValueError`, and anything that is not an `int` (including `bool`) with
|
|
136
|
+
`TypeError`.
|
|
137
|
+
|
|
138
|
+
This is the random port the generators will be built on. It does not
|
|
139
|
+
generate passwords yet.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## The jspassgen ecosystem
|
|
144
|
+
|
|
145
|
+
jspassgen is one core library and the tools, SDKs and site around it.
|
|
146
|
+
Every member is listed in
|
|
147
|
+
[`docs/ecosystem.json`](https://github.com/sebastienrousseau/jspassgen/blob/main/docs/ecosystem.json)
|
|
148
|
+
and, from the suite's first lockstep release, every member ships the same
|
|
149
|
+
version ([ADR 0001](https://github.com/sebastienrousseau/jspassgen/blob/main/docs/adr/0001-ecosystem-lockstep.md)).
|
|
150
|
+
The JavaScript tools depend on the core and add no generation logic of
|
|
151
|
+
their own; each SDK is a native port that is checked against the core's
|
|
152
|
+
conformance kit as its generators land.
|
|
153
|
+
|
|
154
|
+
| Component | Purpose | Use case |
|
|
155
|
+
| :--- | :--- | :--- |
|
|
156
|
+
| [`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 |
|
|
157
|
+
| [`jspassgen-cli`](https://github.com/sebastienrousseau/jspassgen-cli) | Command-line generator built on the core | Passwords in a terminal or a script |
|
|
158
|
+
| [`jspassgen-mcp`](https://github.com/sebastienrousseau/jspassgen-mcp) | Local stdio MCP server | AI agents that need a generated secret |
|
|
159
|
+
| [`jspassgen-lsp`](https://github.com/sebastienrousseau/jspassgen-lsp) | Language server for weak literal secrets | Editors checking configuration and `.env` files |
|
|
160
|
+
| **`jspassgen-sdk-python`** | Native port on the `secrets` module | Python programs |
|
|
161
|
+
| [`jspassgen-sdk-rust`](https://github.com/sebastienrousseau/jspassgen-sdk-rust) | Native port on the OS CSPRNG | Rust programs |
|
|
162
|
+
| [`jspassgen-sdk-java`](https://github.com/sebastienrousseau/jspassgen-sdk-java) | Native port on `SecureRandom` | JVM programs |
|
|
163
|
+
| [`jspassgen-sdk-dotnet`](https://github.com/sebastienrousseau/jspassgen-sdk-dotnet) | Native port on `RandomNumberGenerator` | .NET programs |
|
|
164
|
+
| [`jspassgen-sdk-cpp`](https://github.com/sebastienrousseau/jspassgen-sdk-cpp) | Native C++17 port on the OS CSPRNG | C++ programs |
|
|
165
|
+
| [`jspassgen.github.io`](https://github.com/sebastienrousseau/jspassgen.github.io) | Source of [jspassgen.com](https://jspassgen.com) | Evaluating the suite |
|
|
166
|
+
|
|
167
|
+
Every member ships at 0.0.22, the suite's first lockstep release: the
|
|
168
|
+
core, CLI, MCP and LSP servers on npm, the Python, Rust, Java and .NET
|
|
169
|
+
SDKs on PyPI, crates.io, Maven Central and NuGet, and the C++ SDK and
|
|
170
|
+
the site as GitHub releases. The table gives each member's purpose, and
|
|
171
|
+
each README's Capabilities at a glance says what works today.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Capabilities at a glance
|
|
176
|
+
|
|
177
|
+
| Area | Capability | Status |
|
|
178
|
+
| :--- | :--- | :--- |
|
|
179
|
+
| Randomness | `RandomGeneratorPort`: `random_bytes(n)`, `random_int(max)` | Released in 0.0.22 |
|
|
180
|
+
| Randomness | `SecretsRandom`: the port on `secrets`, unbiased `random_int` | Released in 0.0.22 |
|
|
181
|
+
| Conformance | The core's kit vendored into `conformance/`, every draw tape replayed in CI | Planned: the kit ships in jspassgen 0.0.21, not vendored here yet |
|
|
182
|
+
| Generators | The core's password types: `strong`, `base64`, `custom`, `diceware`, `memorable`, `pronounceable`, `honeyword`, `quantum-resistant` | Planned, against the kit |
|
|
183
|
+
| Entropy | Entropy calculation and validation with the core's error messages | Planned, against the kit |
|
|
184
|
+
| Wordlist | The EFF diceware list, byte-identical to the core's | Planned, against the kit |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Ecosystem comparison
|
|
189
|
+
|
|
190
|
+
Not written yet. A comparison with other Python password generators
|
|
191
|
+
compares generators, and this package has none yet. It will be written,
|
|
192
|
+
with evidence, once the generators pass the conformance kit.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Benchmarks
|
|
197
|
+
|
|
198
|
+
None are published yet. There is no generator to measure, and timing a
|
|
199
|
+
thin wrapper around `secrets` would say nothing about the port.
|
|
200
|
+
Benchmarks arrive with the generators.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Features
|
|
205
|
+
|
|
206
|
+
- `jspassgen.ports.RandomGeneratorPort` is a runtime-checkable
|
|
207
|
+
`typing.Protocol` with `random_bytes(n) -> bytes` and
|
|
208
|
+
`random_int(max) -> int`, the Python form of the core's
|
|
209
|
+
`RandomGeneratorPort` (`generateRandomBytes`, `generateRandomInt`).
|
|
210
|
+
- `jspassgen.adapters.SecretsRandom` implements the port on `secrets`.
|
|
211
|
+
It is stateless and safe to share between threads.
|
|
212
|
+
- `jspassgen.__version__` holds the installed version, read from the
|
|
213
|
+
package metadata.
|
|
214
|
+
|
|
215
|
+
The top-level package exports `RandomGeneratorPort`, `SecretsRandom` and
|
|
216
|
+
`__version__`.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Configuration
|
|
221
|
+
|
|
222
|
+
There is nothing to configure yet. Code that needs randomness takes a
|
|
223
|
+
`RandomGeneratorPort`, so a test can pass a deterministic implementation
|
|
224
|
+
in place of `SecretsRandom`; the conformance kit replays recorded draws
|
|
225
|
+
this way. Never pass a non-cryptographic source when generating a real
|
|
226
|
+
secret.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Examples
|
|
231
|
+
|
|
232
|
+
None yet. The only public surface is the random port, and the Quick
|
|
233
|
+
Start above covers it. Runnable examples arrive with the generators.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## When not to use jspassgen-sdk-python
|
|
238
|
+
|
|
239
|
+
- This version generates no passwords or passphrases. Use the
|
|
240
|
+
JavaScript [`jspassgen`](https://github.com/sebastienrousseau/jspassgen)
|
|
241
|
+
core, or `secrets` directly (`secrets.token_urlsafe`, `secrets.choice`).
|
|
242
|
+
- Byte-for-byte agreement with the JavaScript core is the goal, but no
|
|
243
|
+
vector of the core's conformance kit runs here yet.
|
|
244
|
+
- `SecretsRandom` cannot be seeded, by design. A deterministic port is
|
|
245
|
+
for tests only, so this is the wrong tool for a reproducible sequence.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Development
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
mise install # Python 3.14, uv 0.13.1, Node 24 (mise.toml)
|
|
253
|
+
make check # versions, ruff, mypy --strict, complexity, 100% coverage
|
|
254
|
+
make audit # pip-audit over every locked dependency
|
|
255
|
+
make build # build and check the sdist and wheel
|
|
256
|
+
make docs # build the manual (mkdocs --strict)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
`make check` is the gate CI runs: the version restatements, ruff (lint
|
|
260
|
+
and format), `mypy --strict`, the complexity ceilings (cyclomatic 10,
|
|
261
|
+
cognitive 15, Halstead difficulty 30, 60 lines per function, 500 per
|
|
262
|
+
file) and the unit tests at 100% line and branch coverage. CI also runs
|
|
263
|
+
shellcheck, the API compatibility check (griffe) and the docs lint
|
|
264
|
+
(markdownlint, codespell, REUSE, links and the README check).
|
|
265
|
+
[`DEVELOPMENT.md`](DEVELOPMENT.md) maps every CI gate to its command.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Security
|
|
270
|
+
|
|
271
|
+
The package draws randomness only from `secrets` (the OS CSPRNG), makes
|
|
272
|
+
no network call, has no telemetry and never logs. A test fails if the
|
|
273
|
+
library imports `random`, `socket`, `ssl`, `http`, `urllib` or an HTTP
|
|
274
|
+
client. Error messages name the argument but never repeat its value.
|
|
275
|
+
`random_int` is unbiased by rejection sampling, and the tests check its
|
|
276
|
+
output for uniformity (chi-squared) and against the share a modulo would
|
|
277
|
+
give.
|
|
278
|
+
|
|
279
|
+
Report vulnerabilities according to [`SECURITY.md`](SECURITY.md).
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Documentation
|
|
284
|
+
|
|
285
|
+
- [Manual](docs/index.md)
|
|
286
|
+
- [Developer documentation](DEVELOPMENT.md)
|
|
287
|
+
- [Architecture](docs/ARCHITECTURE.md)
|
|
288
|
+
- [Roadmap](docs/ROADMAP.md)
|
|
289
|
+
- [Policies](docs/POLICIES.md)
|
|
290
|
+
- [Changelog](CHANGELOG.md)
|
|
291
|
+
- [Contributing](CONTRIBUTING.md)
|
|
292
|
+
- [Governance](GOVERNANCE.md)
|
|
293
|
+
- [Support](SUPPORT.md)
|
|
294
|
+
- [Agent rules](AGENTS.md)
|
|
295
|
+
|
|
296
|
+
The API reference is the docstrings; there is no rendered API reference
|
|
297
|
+
yet.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Stability guarantees
|
|
302
|
+
|
|
303
|
+
- Versions advance in `0.0.1` steps in lockstep with the jspassgen suite;
|
|
304
|
+
0.0.22 is the first released suite version.
|
|
305
|
+
- The breaking axis is the public API of `jspassgen`: a removed or
|
|
306
|
+
renamed name, argument or exception is breaking.
|
|
307
|
+
- Once generators exist, output is part of the contract: the same
|
|
308
|
+
configuration and the same random draws must produce the same password
|
|
309
|
+
as the JavaScript core, so a change to the order or number of draws is
|
|
310
|
+
breaking even when no signature moves.
|
|
311
|
+
- Names that start with an underscore, modules included, are private.
|
|
312
|
+
- A public name is deprecated for at least one release before removal.
|
|
313
|
+
- The Python floor moves only as the [toolchain policy](docs/POLICIES.md)
|
|
314
|
+
describes.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## License
|
|
319
|
+
|
|
320
|
+
Licensed under either [Apache License 2.0](LICENSE-APACHE) or
|
|
321
|
+
[MIT](LICENSE-MIT), at your option.
|