baichun-framework-core 0.1.0

Core module for Baichun-Rust framework
Documentation
# baichun-framework-core

[![Crates.io](https://img.shields.io/crates/v/baichun-framework-core.svg)](https://crates.io/crates/baichun-framework-core)
[![Documentation](https://docs.rs/baichun-framework-core/badge.svg)](https://docs.rs/baichun-framework-core)
[![License](https://img.shields.io/crates/l/baichun-framework-core.svg)](LICENSE)

`baichun-framework-core` 是 Baichun Framework 的核心模块,提供了一系列基础功能和工具,用于构建企业级 Web 应用。

## 特性

- 错误处理:使用 `thiserror``anyhow` 提供统一的错误处理机制
- 异步支持:基于 `tokio` 的异步运行时
- 序列化:使用 `serde``serde_json` 进行数据序列化
- 日志:集成 `tracing` 日志系统
- 安全:
  - JWT 令牌生成和验证
  - 密码加密和验证
  - 随机数生成
  - HMAC 签名
- 时间处理:基于 `chrono` 的时间工具
- 其他工具:
  - UUID 生成
  - 正则表达式
  - URL 处理
  - 数据验证

## 安装

将以下内容添加到你的 `Cargo.toml` 文件中:

```toml
[dependencies]
baichun-framework-core = "0.1"
```

## 使用示例

```rust
use baichun_framework_core::jwt::{create_token, verify_token};
use baichun_framework_core::password::{hash_password, verify_password};

// JWT 令牌示例
let claims = Claims {
    sub: "user123".to_string(),
    exp: 1735689600, // 2025-01-01
};
let token = create_token(&claims, "your-secret-key")?;
let verified = verify_token(&token, "your-secret-key")?;

// 密码加密示例
let password = "my-secure-password";
let hashed = hash_password(password)?;
let is_valid = verify_password(password, &hashed)?;
```

## 特性标记

- `full`:启用所有功能(默认)
- `jwt`:启用 JWT 相关功能
- `password`:启用密码加密相关功能
- `validation`:启用数据验证功能

## 许可证

本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。