aboutsummaryrefslogtreecommitdiffstats
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-16 14:41:35 +0300
committerYigit Sever2021-04-16 14:41:35 +0300
commitabe7d7e11638b5496fa89da73823701dc0f6e5d4 (patch)
tree8ecb8574b2c407804bdd9e924032254a6f792b74 /src/handlers.rs
parenta56a71e3971a8d0680439b8217ddee41462fd6dc (diff)
downloadgradecoin-abe7d7e11638b5496fa89da73823701dc0f6e5d4.tar.gz
gradecoin-abe7d7e11638b5496fa89da73823701dc0f6e5d4.tar.bz2
gradecoin-abe7d7e11638b5496fa89da73823701dc0f6e5d4.zip
Passing auth test
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index 2401c0d..ee0fbf0 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -151,7 +151,7 @@ pub async fn authenticate_user(
151 151
152 let res_json = warp::reply::json(&GradeCoinResponse { 152 let res_json = warp::reply::json(&GradeCoinResponse {
153 res: ResponseType::Error, 153 res: ResponseType::Error,
154 message: "Given IV has invalid length".to_owned(), 154 message: "Given IV has invalid length, use a 128 bit key".to_owned(),
155 }); 155 });
156 156
157 return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); 157 return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST));
@@ -176,9 +176,8 @@ pub async fn authenticate_user(
176 } 176 }
177 }; 177 };
178 178
179 println!(">>>{:?}<<<", auth_packet); 179 let mut buf = auth_packet.to_vec();
180 180 let auth_plaintext = match cipher.decrypt(&mut buf) {
181 let auth_plaintext = match cipher.decrypt_vec(&auth_packet) {
182 Ok(p) => p, 181 Ok(p) => p,
183 Err(err) => { 182 Err(err) => {
184 println!( 183 println!(
@@ -195,7 +194,7 @@ pub async fn authenticate_user(
195 } 194 }
196 }; 195 };
197 196
198 let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.clone()) { 197 let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.to_vec()) {
199 Ok(text) => text, 198 Ok(text) => text,
200 Err(err) => { 199 Err(err) => {
201 debug!( 200 debug!(