From d3889bd5945b2ffc63d20942b7730b5a1d0e3a42 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 11 Apr 2021 21:39:18 +0300 Subject: Implement User handling and authentication New struct: User, corresponds to a student Blocks and users are persistent (written to a text file) PostgreSQL would've been overkill, we have 30 students AuthRequest is the representation for incoming register requests and User is the inner representation Students who are enrolled to the class are hardcoded, only they can register new accounts There are two new tests, one checks if a priviliged (=enrolled) user can create an account and the other checks if a unpriviliged one cannot There are quick verbose error messages that I'm not married to, might move on to something better honestly There's nothing stopping a malicious user to pre-register everyone with mock public keys and effectively lock everyone out, what's a good secret we can use? --- Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index a203a6f..2ae2b25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,8 @@ chrono = { version = "0.4.10", features = ["serde"] } log = "0.4.8" pretty_env_logger = "0.3.1" parking_lot = "0.10.0" +serde_json = "1.0.59" +lazy_static = "1.4.0" [dev-dependencies] -serde_json = "1.0.44" -serde_test = "1.0.104" +serde_test = "1.0.117" -- cgit v1.2.3-70-g09d2