Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add auth and related utilities #3

Merged
merged 10 commits into from
Nov 10, 2024
Merged

Conversation

shivamvijaywargi
Copy link
Contributor

@shivamvijaywargi shivamvijaywargi commented Nov 10, 2024

This pull request includes several updates and new features across various parts of the project. The most important changes include updates to dependencies and scripts, new middleware for authentication, and database schema modifications.

Dependency and Script Updates:

  • package.json: Added new scripts (db:generate, db:migrate, deps:update) and updated several dependencies to their latest versions.

Authentication and Middleware:

  • src/common/middlewares/auth.middleware.ts: Added new middleware functions for authentication, including session validation and role-based access control.
  • src/app.ts: Updated application routing to include authRouter and changed the base route for API endpoints.

Database Schema Changes:

Utility Functions:

  • src/common/utils/crypto.lib.ts: Added functions for password hashing, verification, and strength validation using @node-rs/argon2 and @oslojs/crypto.
  • src/common/utils/sessions.util.ts: Added functions for generating, validating, and invalidating session tokens.This pull request includes several updates and improvements across the codebase, including dependency updates, new utility functions, and database schema changes. The most important changes are listed below:

Dependency and Configuration Updates:

  • Updated various dependencies in package.json and added new scripts for database operations.
  • Added a new word to the spell checker configuration in .vscode/settings.json.

Code Enhancements:

  • Refactored AuthRoles to use a more dynamic approach by leveraging arrays and types in src/common/enums/index.ts.
  • Introduced new utility functions for password hashing, verification, and session token generation in src/common/utils/crypto.lib.ts and src/common/utils/sessions.util.ts. [1] [2]

Database Schema Changes:

  • Added new migration files to create and alter database tables and types, including account, session, and users tables in src/db/migrations/. [1] [2]
  • Updated migration metadata to reflect the new schema changes in src/db/migrations/meta/. [1] [2] [3]

Miscellaneous:

  • Refactored import statements and improved route handling in src/app.ts and other files. [1] [2]
  • Added a new helper function jsonContentRequired in src/common/helpers/json-content-required.ts.
  • Introduced a new constant notFoundSchema in src/common/lib/constants.lib.ts.
  • Updated logger import in src/common/middlewares/pino-logger.middleware.ts.

@shivamvijaywargi shivamvijaywargi self-assigned this Nov 10, 2024
@shivamvijaywargi shivamvijaywargi merged commit b1436da into main Nov 10, 2024
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