refactor: Full TypeScript rewrite with sync API and security hardening (v10.0.0)#995
Open
interpret-tech wants to merge 7 commits intoauth0:masterfrom
Open
refactor: Full TypeScript rewrite with sync API and security hardening (v10.0.0)#995interpret-tech wants to merge 7 commits intoauth0:masterfrom
interpret-tech wants to merge 7 commits intoauth0:masterfrom
Conversation
BREAKING CHANGE: Complete rewrite in TypeScript with Promise-based API This is a major version upgrade that modernizes the entire codebase: ### Breaking Changes - All methods now return Promises (no more callbacks) - Removed callback-based API entirely - Requires Node.js >= 20 and npm >= 10 - TypeScript rewrite with full type definitions ### New Features - Full TypeScript support with comprehensive type definitions - Modern Promise-based API using async/await - Enhanced algorithm support including EdDSA (Ed25519/Ed448) - Improved error handling with typed error classes - Better security defaults and validation ### Technical Changes - Migrated from CommonJS to TypeScript modules - Replaced Mocha/Chai with Jest for testing - Updated from ESLint legacy config to flat config - Modernized all dependencies - Added comprehensive JSDoc documentation - Improved test coverage and added new test cases ### Migration - See MIGRATION_GUIDE_V10.md for detailed upgrade instructions - All existing functionality is preserved with Promise-based equivalents Co-authored-by: Dylan Keys <dylan@interpret.tech>
- Add CI workflow for testing on Node.js 20.x and 22.x - Add PR checks for title validation, security audit, and bundle size - Add pre-commit hook for linting and testing staged files - Add pre-push hook for full test suite validation - Configure husky and lint-staged for git hook management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…security hardening - Remove all JavaScript source files and legacy tests - Add synchronous versions of sign and verify functions - Reorganize test structure into unit tests with TypeScript - Update build configuration for dual CommonJS/ESM support - Add shared utility modules for better code organization - Improve algorithm implementations with better type safety - Enhance security with stricter input validation and error handling - Harden against timing attacks in signature verification - Add comprehensive type guards for JWT payload validation - Update documentation with new API references BREAKING CHANGE: This completes the v10 migration to TypeScript with new synchronous APIs and reorganized module structure
- Rename wiki/ directory to docs/ for better organization - Update README.md to link directly to documentation files in docs/ folder - Remove external wiki links in favor of local documentation
- Remove convert-tests-to-async.js as it's no longer needed - All tests have been migrated to TypeScript with modern async/await syntax - The script was used during migration but is now obsolete
Replace CommonJS require with ES module import for the 'ms' package
The ms package requires a StringValue type for string inputs. Added type assertion to satisfy TypeScript compiler requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please
see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
This PR completes the TypeScript migration for the jsonwebtoken library (v10.0.0), introducing significant improvements in type safety, security, and developer experience.
Key changes:
signSync()andverifySync()functions for synchronous operations, addressing long-standing community requestsBreaking changes:
References
Testing
The entire test suite has been reorganised and expanded:
To test this PR: