Skip to content

feat: add optional time backend support with chrono and time crates#83

Open
facorazza wants to merge 1 commit into
rrrodzilla:mainfrom
facorazza:main
Open

feat: add optional time backend support with chrono and time crates#83
facorazza wants to merge 1 commit into
rrrodzilla:mainfrom
facorazza:main

Conversation

@facorazza

Copy link
Copy Markdown
  • Updated Cargo.toml to include optional dependencies for time and chrono.
  • Enhanced error handling in src/error.rs to support time formatting errors from both time and chrono.
  • Refactored time-related functions in src/generic/claims/mod.rs to use feature flags for time and chrono.
  • Updated documentation in src/lib.rs to reflect new time backend options.
  • Implemented mutually exclusive feature checks for time and chrono in src/lib.rs.
  • Modified prelude error handling in src/prelude/error.rs to accommodate new time parsing errors.
  • Refactored PasetoBuilder in src/prelude/paseto_builder.rs to support expiration and not-before claims using both time and chrono.
  • Updated PasetoParser in src/prelude/paseto_parser.rs to validate expiration and not-before claims with both time and chrono.
  • Added unit tests in src/prelude/paseto_parser.rs to ensure correct functionality with both time and chrono.

Please provide enough information so that others can review your pull request:

Explain the details for making this change. What existing problem does the pull request solve?

Allows to use chrono instead of time crate in existing projects to avoid implementation conflicts with other crates (e.g. sqlx)

Test plan (required)

Added unit tests specific to chrono

Code formatting

cargo fmt and cargo clippy

Closing issues

closes #82

- Updated Cargo.toml to include optional dependencies for time and chrono.
- Enhanced error handling in src/error.rs to support time formatting errors from both time and chrono.
- Refactored time-related functions in src/generic/claims/mod.rs to use feature flags for time and chrono.
- Updated documentation in src/lib.rs to reflect new time backend options.
- Implemented mutually exclusive feature checks for time and chrono in src/lib.rs.
- Modified prelude error handling in src/prelude/error.rs to accommodate new time parsing errors.
- Refactored PasetoBuilder in src/prelude/paseto_builder.rs to support expiration and not-before claims using both time and chrono.
- Updated PasetoParser in src/prelude/paseto_parser.rs to validate expiration and not-before claims with both time and chrono.
- Added unit tests in src/prelude/paseto_parser.rs to ensure correct functionality with both time and chrono.
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.

Adding support for chrono

1 participant