jwt-toolkit 1.0.0__tar.gz → 1.2.0__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.
Files changed (111) hide show
  1. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/workflows/ci.yml +4 -4
  2. jwt_toolkit-1.2.0/.github/workflows/publish.yml +87 -0
  3. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.pre-commit-config.yaml +4 -4
  4. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/CONTRIBUTING.md +21 -12
  5. jwt_toolkit-1.2.0/PKG-INFO +478 -0
  6. jwt_toolkit-1.2.0/README.md +447 -0
  7. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/SECURITY.md +5 -5
  8. jwt_toolkit-1.2.0/docs/plans/01-correctness-and-robustness.md +260 -0
  9. jwt_toolkit-1.2.0/docs/plans/02-verification-policies.md +78 -0
  10. jwt_toolkit-1.2.0/docs/plans/03-reports-and-automation.md +89 -0
  11. jwt_toolkit-1.2.0/docs/plans/04-jwks-and-discovery.md +86 -0
  12. jwt_toolkit-1.2.0/docs/plans/05-developer-workflows.md +101 -0
  13. jwt_toolkit-1.2.0/docs/plans/06-quality-and-releases.md +113 -0
  14. jwt_toolkit-1.2.0/docs/plans/07-delivery-and-handoff.md +106 -0
  15. jwt_toolkit-1.2.0/docs/plans/08-architecture-refactor.md +118 -0
  16. jwt_toolkit-1.2.0/docs/plans/README.md +88 -0
  17. jwt_toolkit-1.2.0/jwt_toolkit/__init__.py +6 -0
  18. jwt_toolkit-1.2.0/jwt_toolkit/cli/__init__.py +93 -0
  19. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/cli/algorithms.py +19 -11
  20. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/cli/banner.py +27 -34
  21. jwt_toolkit-1.2.0/jwt_toolkit/cli/console.py +47 -0
  22. jwt_toolkit-1.2.0/jwt_toolkit/cli/credentials.py +53 -0
  23. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/cli/decoding.py +46 -11
  24. jwt_toolkit-1.2.0/jwt_toolkit/cli/panels.py +31 -0
  25. jwt_toolkit-1.2.0/jwt_toolkit/cli/wordlists.py +14 -0
  26. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/commands/audit.py +98 -39
  27. jwt_toolkit-1.2.0/jwt_toolkit/commands/crack.py +327 -0
  28. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/commands/decode.py +34 -5
  29. jwt_toolkit-1.2.0/jwt_toolkit/commands/diff.py +151 -0
  30. jwt_toolkit-1.2.0/jwt_toolkit/commands/download_wordlists.py +266 -0
  31. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/commands/forge.py +21 -16
  32. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/commands/generate_secret.py +15 -5
  33. jwt_toolkit-1.2.0/jwt_toolkit/commands/sign.py +313 -0
  34. jwt_toolkit-1.2.0/jwt_toolkit/commands/verify.py +270 -0
  35. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/core/auditor.py +259 -85
  36. jwt_toolkit-1.2.0/jwt_toolkit/core/claims.py +102 -0
  37. jwt_toolkit-1.2.0/jwt_toolkit/core/cracker.py +152 -0
  38. jwt_toolkit-1.2.0/jwt_toolkit/core/crypto.py +324 -0
  39. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/core/decoder.py +51 -9
  40. jwt_toolkit-1.2.0/jwt_toolkit/core/diff.py +162 -0
  41. jwt_toolkit-1.2.0/jwt_toolkit/core/encoding.py +52 -0
  42. jwt_toolkit-1.2.0/jwt_toolkit/core/errors.py +59 -0
  43. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/core/forge.py +35 -25
  44. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/jwt_toolkit/core/jwks.py +109 -28
  45. jwt_toolkit-1.2.0/jwt_toolkit/core/lifetime.py +35 -0
  46. jwt_toolkit-1.2.0/jwt_toolkit/core/timestamps.py +57 -0
  47. jwt_toolkit-1.2.0/jwt_toolkit/core/wordlist.py +81 -0
  48. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/pyproject.toml +10 -6
  49. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/conftest.py +19 -2
  50. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/helpers.py +23 -0
  51. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_auditor.py +175 -0
  52. jwt_toolkit-1.2.0/tests/test_claims.py +89 -0
  53. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_cmd_audit.py +95 -1
  54. jwt_toolkit-1.2.0/tests/test_cmd_crack.py +305 -0
  55. jwt_toolkit-1.2.0/tests/test_cmd_decode.py +160 -0
  56. jwt_toolkit-1.2.0/tests/test_cmd_diff.py +129 -0
  57. jwt_toolkit-1.2.0/tests/test_cmd_download_wordlists.py +184 -0
  58. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_cmd_forge.py +22 -0
  59. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_cmd_generate_secret.py +25 -0
  60. jwt_toolkit-1.2.0/tests/test_cmd_global_flags.py +67 -0
  61. jwt_toolkit-1.2.0/tests/test_cmd_sign.py +527 -0
  62. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_cmd_verify.py +237 -15
  63. jwt_toolkit-1.2.0/tests/test_cracker.py +74 -0
  64. jwt_toolkit-1.2.0/tests/test_credentials.py +55 -0
  65. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_crypto.py +12 -1
  66. jwt_toolkit-1.2.0/tests/test_crypto_asymmetric.py +267 -0
  67. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_decoder.py +44 -0
  68. jwt_toolkit-1.2.0/tests/test_diff.py +126 -0
  69. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_forge.py +10 -0
  70. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/test_jwks.py +126 -0
  71. jwt_toolkit-1.2.0/tests/test_lifetime.py +56 -0
  72. jwt_toolkit-1.2.0/tests/test_markup_escaping.py +59 -0
  73. jwt_toolkit-1.2.0/tests/test_package.py +7 -0
  74. jwt_toolkit-1.2.0/tests/test_timestamps.py +64 -0
  75. jwt_toolkit-1.2.0/tests/test_wordlist.py +55 -0
  76. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/uv.lock +269 -185
  77. jwt_toolkit-1.0.0/.github/workflows/publish.yml +0 -51
  78. jwt_toolkit-1.0.0/PKG-INFO +0 -292
  79. jwt_toolkit-1.0.0/README.md +0 -261
  80. jwt_toolkit-1.0.0/assets/images/demo.jpg +0 -0
  81. jwt_toolkit-1.0.0/jwt_toolkit/cli/__init__.py +0 -110
  82. jwt_toolkit-1.0.0/jwt_toolkit/cli/console.py +0 -35
  83. jwt_toolkit-1.0.0/jwt_toolkit/cli/panels.py +0 -28
  84. jwt_toolkit-1.0.0/jwt_toolkit/commands/crack.py +0 -322
  85. jwt_toolkit-1.0.0/jwt_toolkit/commands/download_wordlists.py +0 -216
  86. jwt_toolkit-1.0.0/jwt_toolkit/commands/sign.py +0 -146
  87. jwt_toolkit-1.0.0/jwt_toolkit/commands/verify.py +0 -290
  88. jwt_toolkit-1.0.0/jwt_toolkit/core/crypto.py +0 -229
  89. jwt_toolkit-1.0.0/jwt_toolkit/core/encoding.py +0 -22
  90. jwt_toolkit-1.0.0/jwt_toolkit/core/errors.py +0 -25
  91. jwt_toolkit-1.0.0/tests/test_cmd_crack.py +0 -146
  92. jwt_toolkit-1.0.0/tests/test_cmd_decode.py +0 -69
  93. jwt_toolkit-1.0.0/tests/test_cmd_download_wordlists.py +0 -89
  94. jwt_toolkit-1.0.0/tests/test_cmd_sign.py +0 -180
  95. jwt_toolkit-1.0.0/tests/test_crypto_asymmetric.py +0 -131
  96. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.editorconfig +0 -0
  97. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  98. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  99. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/ISSUE_TEMPLATE/documentation.yml +0 -0
  100. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  101. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  102. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.github/dependabot.yml +0 -0
  103. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.gitignore +0 -0
  104. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/.python-version +0 -0
  105. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/LICENSE +0 -0
  106. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/Makefile +0 -0
  107. {jwt_toolkit-1.0.0/jwt_toolkit → jwt_toolkit-1.2.0/jwt_toolkit/commands}/__init__.py +0 -0
  108. {jwt_toolkit-1.0.0/jwt_toolkit/commands → jwt_toolkit-1.2.0/jwt_toolkit/core}/__init__.py +0 -0
  109. /jwt_toolkit-1.0.0/jwt_toolkit/core/__init__.py → /jwt_toolkit-1.2.0/jwt_toolkit/py.typed +0 -0
  110. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/tests/__init__.py +0 -0
  111. {jwt_toolkit-1.0.0 → jwt_toolkit-1.2.0}/wordlists/common-secrets.txt +0 -0
@@ -19,7 +19,7 @@ jobs:
19
19
  with:
20
20
  enable-cache: true
21
21
  - name: Install dev dependencies
22
- run: uv sync --group dev
22
+ run: uv sync --locked --group dev
23
23
  - name: Ruff format (check only)
24
24
  run: uv run ruff format --check .
25
25
  - name: Ruff lint
@@ -33,7 +33,7 @@ jobs:
33
33
  - uses: astral-sh/setup-uv@v7
34
34
  with:
35
35
  enable-cache: true
36
- - run: uv sync --group dev
36
+ - run: uv sync --locked --group dev
37
37
  - run: uv run mypy
38
38
 
39
39
  security:
@@ -44,7 +44,7 @@ jobs:
44
44
  - uses: astral-sh/setup-uv@v7
45
45
  with:
46
46
  enable-cache: true
47
- - run: uv sync --group dev
47
+ - run: uv sync --locked --group dev
48
48
  - name: Bandit static analysis
49
49
  run: uv run bandit -c pyproject.toml -r jwt_toolkit --severity-level medium
50
50
  - name: pip-audit dependency CVEs
@@ -63,7 +63,7 @@ jobs:
63
63
  with:
64
64
  enable-cache: true
65
65
  python-version: ${{ matrix.python-version }}
66
- - run: uv sync --group dev
66
+ - run: uv sync --locked --group dev
67
67
  - name: Run tests with coverage
68
68
  run: uv run pytest --cov --cov-report=term-missing --cov-report=xml -n auto
69
69
  - name: Upload coverage artifact
@@ -0,0 +1,87 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: publish-${{ github.ref }}
10
+ cancel-in-progress: false
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ validate:
17
+ name: Validate release commit
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+ - uses: astral-sh/setup-uv@v7
22
+ with:
23
+ enable-cache: true
24
+ - name: Require a tag matching the package version
25
+ env:
26
+ REF_TYPE: ${{ github.ref_type }}
27
+ REF_NAME: ${{ github.ref_name }}
28
+ run: |
29
+ version="$(uv version --short)"
30
+ if [ "$REF_TYPE" != "tag" ] || [ "$REF_NAME" != "v$version" ]; then
31
+ echo "::error::Publishing requires tag v$version; got $REF_TYPE '$REF_NAME'"
32
+ exit 1
33
+ fi
34
+ - name: Install locked dev dependencies
35
+ run: uv sync --locked --group dev
36
+ - name: Ruff format (check only)
37
+ run: uv run ruff format --check .
38
+ - name: Ruff lint
39
+ run: uv run ruff check .
40
+ - name: Type check
41
+ run: uv run mypy
42
+ - name: Tests with coverage gate
43
+ run: uv run pytest --cov -n auto
44
+ - name: Bandit static analysis
45
+ run: uv run bandit -c pyproject.toml -r jwt_toolkit --severity-level medium
46
+ - name: pip-audit dependency CVEs
47
+ run: uv run pip-audit
48
+
49
+ build:
50
+ name: Build distribution
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v7
54
+ - uses: astral-sh/setup-uv@v7
55
+ with:
56
+ enable-cache: true
57
+ - name: Build sdist + wheel
58
+ run: uv build
59
+ - name: Check package metadata
60
+ run: uvx twine check --strict dist/*
61
+ - name: Upload build artifacts
62
+ uses: actions/upload-artifact@v7
63
+ with:
64
+ name: dist
65
+ path: dist/
66
+
67
+ publish:
68
+ name: Publish to PyPI
69
+ needs: [validate, build]
70
+ runs-on: ubuntu-latest
71
+ environment:
72
+ name: pypi
73
+ url: https://pypi.org/p/jwt-toolkit
74
+ permissions:
75
+ id-token: write
76
+ attestations: write
77
+ contents: read
78
+ steps:
79
+ - name: Download build artifacts
80
+ uses: actions/download-artifact@v8
81
+ with:
82
+ name: dist
83
+ path: dist/
84
+ - name: Publish to PyPI (Trusted Publishing + PEP 740 attestations)
85
+ uses: pypa/gh-action-pypi-publish@release/v1
86
+ with:
87
+ attestations: true
@@ -8,7 +8,7 @@
8
8
  repos:
9
9
  # General hygiene
10
10
  - repo: https://github.com/pre-commit/pre-commit-hooks
11
- rev: v5.0.0
11
+ rev: v6.0.0
12
12
  hooks:
13
13
  - id: trailing-whitespace
14
14
  - id: end-of-file-fixer
@@ -21,15 +21,15 @@ repos:
21
21
  # Ruff — formatter + linter (replaces black, flake8, isort).
22
22
  # Order matters: format first, then lint so the linter sees formatted code.
23
23
  - repo: https://github.com/astral-sh/ruff-pre-commit
24
- rev: v0.15.14
24
+ rev: v0.17.1
25
25
  hooks:
26
26
  - id: ruff-format
27
- - id: ruff
27
+ - id: ruff-check
28
28
  args: ["--fix"]
29
29
 
30
30
  # Bandit static security scan. Source-only, no network — safe to run on commit.
31
31
  - repo: https://github.com/PyCQA/bandit
32
- rev: 1.8.6
32
+ rev: 1.9.4
33
33
  hooks:
34
34
  - id: bandit
35
35
  args: ["-c", "pyproject.toml", "--severity-level", "medium"]
@@ -46,28 +46,37 @@ jwt-toolkit/
46
46
  │ ├── __init__.py # Package version
47
47
  │ ├── cli/ # CLI plumbing: banner, console, panels, decoding helpers
48
48
  │ │ ├── __init__.py # Click root group, global flags, command registration
49
- │ │ ├── algorithms.py # CLI-side algorithm validation and listing
50
- │ │ ├── banner.py # Startup banner and custom help renderer
51
- │ │ ├── console.py # Rich console wiring (quiet, no-color, JSON modes)
52
- │ │ ├── decoding.py # Shared CLI helpers for decoding input
53
- │ │ └── panels.py # Reusable Rich panels (header, payload, verdicts, findings)
49
+ │ │ ├── algorithms.py # CLI-side algorithm validation
50
+ │ │ ├── banner.py # Startup banner, help screen, and the COMMANDS/EXAMPLES lists
51
+ │ │ ├── console.py # Result, error, and status consoles (quiet, no-color)
52
+ │ │ ├── credentials.py # --secret / --secret-file handling
53
+ │ │ ├── decoding.py # Token input (argument, @file, stdin) and error envelopes
54
+ │ │ ├── panels.py # Reusable Rich panels for errors and results
55
+ │ │ └── wordlists.py # Location of the bundled wordlist
54
56
  │ ├── commands/ # One file per `jwt-toolkit <command>`
55
57
  │ │ ├── audit.py
56
58
  │ │ ├── crack.py
57
59
  │ │ ├── decode.py
60
+ │ │ ├── diff.py
58
61
  │ │ ├── download_wordlists.py
59
62
  │ │ ├── forge.py
60
63
  │ │ ├── generate_secret.py
61
64
  │ │ ├── sign.py
62
65
  │ │ └── verify.py
63
66
  │ └── core/ # Pure logic, no Click and no Rich
64
- │ ├── auditor.py # Static audit rules and verdict scoring
67
+ │ ├── auditor.py # Static audit rules, key-material checks, and grading
68
+ │ ├── claims.py # Claim and critical-header checks used by verify
69
+ │ ├── cracker.py # Batched, optionally parallel HMAC secret search
65
70
  │ ├── crypto.py # HMAC and asymmetric signing and verification
66
- │ ├── decoder.py # JWT parsing and base64url helpers
67
- │ ├── encoding.py # base64url, JSON canonicalization
68
- │ ├── errors.py # Domain-specific exceptions
71
+ │ ├── decoder.py # JWT splitting and decoding
72
+ │ ├── diff.py # Field-by-field token comparison
73
+ │ ├── encoding.py # base64url and strict JSON helpers
74
+ │ ├── errors.py # Domain-specific exceptions with stable codes
69
75
  │ ├── forge.py # Defensive attack-shaped variant generation
70
- │ └── jwks.py # JWKS fetching, caching, and key selection
76
+ │ ├── jwks.py # JWKS fetching and key selection
77
+ │ ├── lifetime.py # --expires-in parsing
78
+ │ ├── timestamps.py # Human-readable time claims
79
+ │ └── wordlist.py # Streaming wordlist reader and candidate expansion
71
80
  ├── tests/ # Pytest suite mirroring the source layout
72
81
  │ ├── conftest.py # Shared fixtures (keys, tokens, tmp wordlists)
73
82
  │ ├── helpers.py # Test helpers
@@ -189,8 +198,8 @@ We follow [Conventional Commits](https://www.conventionalcommits.org/). The form
189
198
 
190
199
  `<scope>` is a short identifier for the area of the codebase. Use a command name, a `core/` module name, or a high-level area:
191
200
 
192
- - Command scopes: `audit`, `crack`, `decode`, `verify`, `sign`, `forge`, `generate-secret`, `download-wordlists`
193
- - Core scopes: `core`, `auditor`, `crypto`, `decoder`, `forge`, `jwks`, `jwks-cache`
201
+ - Command scopes: `audit`, `crack`, `decode`, `diff`, `verify`, `sign`, `forge`, `generate-secret`, `download-wordlists`
202
+ - Core scopes: `core`, `auditor`, `claims`, `cracker`, `crypto`, `decoder`, `forge`, `jwks`, `wordlist`
194
203
  - Other scopes: `cli`, `readme`, `ci`, `deps`, `release`
195
204
 
196
205
  Rules: