Skip to content

refactor: ⚡ performance upgrade - complete rewriting#99

Merged
ixunio merged 1 commit into
mainfrom
refacto-speed
Jan 25, 2026
Merged

refactor: ⚡ performance upgrade - complete rewriting#99
ixunio merged 1 commit into
mainfrom
refacto-speed

Conversation

@ixunio

@ixunio ixunio commented Jan 25, 2026

Copy link
Copy Markdown
Owner

Complete revamp of internal code for JWT/JWS/Validation, with mostly no breaking changes. Dramatic speed up for encoding and decoding operations with or without validation running.

  • 🎨 JWT and JWS classes have been removed in favor of pure functional paradigm
    • encode() / decode() are now written in jwt.py as pure functions, same for jws encode and decode functions.
    • 🔥 JWT, JWS, JWSTokenLifeCycle removed
  • cryptography is now used by default for all algorithms and is a mandatory requirement. HMAC now uses cryptography instead of hmac
  • ⚡ default generated headers does not run validation
  • ⚡ during encoding, claims JSON payload is directly created from Pydantic .model_dump_json()
  • ⚡ Removed default config logic: ValidationConfig is now a simple Python class with no mutability issues. Removed the deep copy from previous logic
  • ⚰️ removed NoneAlgorithm and NoneKey
  • set_max_token_bytes() to update the max token bytes size allowed during encoding/decoding operation. Replaces previous low level JWT init parameter.
  • ⚡ cache algorithm instances
  • ⚰️ removed the incomplete 'b64' header validation logic, this is not a supported feature
  • ✅ 100% coverage in tests

@codecov

codecov Bot commented Jan 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.02597% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.49%. Comparing base (ed45872) to head (dece810).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
superjwt/validations.py 97.64% 0 Missing and 2 partials ⚠️
superjwt/shared.py 98.18% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   97.97%   99.49%   +1.51%     
==========================================
  Files           9       10       +1     
  Lines        1089      993      -96     
  Branches      132      118      -14     
==========================================
- Hits         1067      988      -79     
+ Misses         19        0      -19     
- Partials        3        5       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ixunio ixunio merged commit dece810 into main Jan 25, 2026
16 checks passed
@ixunio ixunio deleted the refacto-speed branch January 25, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant