Closed DanielRivers closed 6 months ago
The recent updates focus on improving consistency in naming conventions and enhancing security features in the codebase. Key changes include renaming a configuration property, updating import paths, adding new utility functions, and improving token validation logic. Additionally, a new dependency has been introduced to assist with JWT verification, ensuring robust authentication mechanisms.
File | Change Summary |
---|---|
lib/config.ts |
Updated kinde_domain to kindeDomain and corrected its assignment to process.env.KINDE_DOMAIN . |
lib/utilities/getToken.ts |
Changed import path for hasTokenExpired function. |
lib/utilities/index.ts |
Added checkAudience and validateToken to exports. |
.../token/checkAudience.ts |
Added a check for decoded.aud presence before using includes . |
.../token/hasTokenExpired.ts |
Revised token expiration check logic to compare against current time. |
.../token/validateToken.ts |
Introduced JWT validation using RSA verification. |
package.json |
Added aws-jwt-verify version ^4.0.1 . |
lib/utilities/index.ts (2)
`4-5`: Imports for `checkAudience` and `validateToken` are correctly added. Ensure these modules are properly implemented. --- `7-7`: Export statement correctly includes the new functions. Ensure that all dependent modules update their imports accordingly.lib/utilities/token/hasTokenExpired.ts (1)
`12-12`: The updated expiration check logic is correct and aligns with standard practices for JWT expiration handling.lib/utilities/token/checkAudience.ts (1)
`18-18`: The addition of a safe navigation operator (`?.`) before calling `includes` on `decoded.aud` is a good practice to prevent runtime errors.package.json (1)
`32-32`: The addition of `aws-jwt-verify` at version `^4.0.1` is appropriate for JWT verification functionality. Ensure compatibility with other project dependencies.lib/config.ts (1)
`10-23`: > :memo: **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [13-33] The update to use `kindeDomain` and its assignment from an environment variable enhances configuration consistency and security by not hardcoding sensitive information.lib/utilities/getToken.ts (1)
`7-7`: Correct update of the import statement for `hasTokenExpired`. This change ensures that the correct module is used for token expiration checks.
Explain your changes
checkAudience
andvalidateToken
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor