feat: Implement Crypto and JWT utility modules in Rust

This commit introduces a Rust implementation of the cryptographic and JWT handling utilities, translated from the original TypeScript codebase.

The new `CryptoUtils` module provides core cryptographic functionalities, including:
- AES-256-CBC encryption and decryption.
- Generation, saving, and loading of RSA-4096 key pairs.
- It leverages the `openssl`, `sha2`, and `hex` crates.

The new `JWTUtils` module handles JSON Web Tokens manually, without relying on the `jsonwebtoken` crate. Its features include:
- Creating and signing JWTs using RSA-SHA256.
- Verifying the signature and expiration of tokens.
- Decoding tokens and validating claims.
- This implementation uses the `openssl` crate for signing and verification, ensuring alignment with the `CryptoUtils` module.

Additionally, minor compiler warnings, such as unused imports in `main.rs` and `config.rs`, have been resolved.
This commit is contained in:
2025-08-15 17:03:23 -04:00
parent 3d7da03bcf
commit 29dbca70c4
4 changed files with 487 additions and 3 deletions

View File

@@ -4,8 +4,6 @@ use std::env;
use std::net::SocketAddr;
use std::str::FromStr;
use tracing::error;
#[derive(Debug)]
pub struct Config {
pub bind_address: SocketAddr,