- Added `bcrypt`, `jsonwebtoken`, and `once_cell` dependencies to manage password hashing and JWT handling. - Created `Claims` struct for JWT claims and implemented token generation in the login route. - Implemented user registration and authentication logic in the `auth` module. - Updated error handling to include validation errors. - Created new routes for user registration and login, and integrated them into the main router. - Added tests for the authentication flow, including registration and login scenarios. - Updated user model to include a password hash field. - Refactored user creation logic to include password validation. - Adjusted feed and user routes to utilize JWT for authentication.
37 lines
696 B
TOML
37 lines
696 B
TOML
[package]
|
|
name = "api"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
publish = false
|
|
|
|
[lib]
|
|
name = "api"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
axum = { workspace = true, features = ["macros", "query"] }
|
|
serde = { workspace = true }
|
|
tower = { workspace = true }
|
|
tracing = { workspace = true }
|
|
validator = { workspace = true, features = ["derive"] }
|
|
bcrypt = "0.17.1"
|
|
jsonwebtoken = "9.3.1"
|
|
once_cell = "1.21.3"
|
|
|
|
tower-http = { version = "0.6.6", features = ["fs", "cors"] }
|
|
tower-cookies = "0.11.0"
|
|
anyhow = "1.0.98"
|
|
dotenvy = "0.15.7"
|
|
|
|
# db
|
|
sea-orm = { workspace = true }
|
|
|
|
# doc
|
|
utoipa = { workspace = true }
|
|
|
|
# local dependencies
|
|
app = { path = "../app" }
|
|
models = { path = "../models" }
|
|
|
|
[dev-dependencies]
|