diff options
| -rw-r--r-- | src/handlers.rs | 22 | 
1 files changed, 16 insertions, 6 deletions
| diff --git a/src/handlers.rs b/src/handlers.rs index bf554ab..7e022c3 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
| @@ -116,7 +116,10 @@ pub async fn authenticate_user( | |||
| 116 | 116 | ||
| 117 | let res_json = warp::reply::json(&GradeCoinResponse { | 117 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 118 | res: ResponseType::Error, | 118 | res: ResponseType::Error, | 
| 119 | message: "The ciphertext of the key was not base64 encoded {}, {}".to_owned(), | 119 | message: format!( | 
| 120 | "The ciphertext of the key was not base64 encoded: {}", | ||
| 121 | request.key | ||
| 122 | ), | ||
| 120 | }); | 123 | }); | 
| 121 | 124 | ||
| 122 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 125 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 
| @@ -133,7 +136,10 @@ pub async fn authenticate_user( | |||
| 133 | 136 | ||
| 134 | let res_json = warp::reply::json(&GradeCoinResponse { | 137 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 135 | res: ResponseType::Error, | 138 | res: ResponseType::Error, | 
| 136 | message: "Failed to decrypt the ciphertext of the temporary key".to_owned(), | 139 | message: format!( | 
| 140 | "Failed to decrypt the ciphertext of the temporary key: {:?}", | ||
| 141 | &key_ciphertext | ||
| 142 | ), | ||
| 137 | }); | 143 | }); | 
| 138 | 144 | ||
| 139 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 145 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 
| @@ -152,7 +158,7 @@ pub async fn authenticate_user( | |||
| 152 | 158 | ||
| 153 | let res_json = warp::reply::json(&GradeCoinResponse { | 159 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 154 | res: ResponseType::Error, | 160 | res: ResponseType::Error, | 
| 155 | message: "Given IV has invalid length, use a 128 bit key".to_owned(), | 161 | message: "Given IV has invalid length, use a 128 bit IV".to_owned(), | 
| 156 | }); | 162 | }); | 
| 157 | 163 | ||
| 158 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 164 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 
| @@ -188,7 +194,7 @@ pub async fn authenticate_user( | |||
| 188 | 194 | ||
| 189 | let res_json = warp::reply::json(&GradeCoinResponse { | 195 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 190 | res: ResponseType::Error, | 196 | res: ResponseType::Error, | 
| 191 | message: "The Base64 decoded auth request did not decrypt correctly".to_owned(), | 197 | message: "The base64 decoded auth request did not decrypt correctly".to_owned(), | 
| 192 | }); | 198 | }); | 
| 193 | 199 | ||
| 194 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 200 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 
| @@ -205,7 +211,7 @@ pub async fn authenticate_user( | |||
| 205 | 211 | ||
| 206 | let res_json = warp::reply::json(&GradeCoinResponse { | 212 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 207 | res: ResponseType::Error, | 213 | res: ResponseType::Error, | 
| 208 | message: "Auth plaintext couldn't get converted to UTF-8".to_owned(), | 214 | message: "Auth plaintext could not get converted to UTF-8".to_owned(), | 
| 209 | }); | 215 | }); | 
| 210 | 216 | ||
| 211 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 217 | return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); | 
| @@ -343,7 +349,11 @@ pub async fn propose_block( | |||
| 343 | warn!("New block proposal: {:?}", &new_block); | 349 | warn!("New block proposal: {:?}", &new_block); | 
| 344 | 350 | ||
| 345 | if new_block.transaction_list.len() < BLOCK_TRANSACTION_COUNT as usize { | 351 | if new_block.transaction_list.len() < BLOCK_TRANSACTION_COUNT as usize { | 
| 346 | debug!("{} transactions offered, needed {}", new_block.transaction_list.len(), BLOCK_TRANSACTION_COUNT); | 352 | debug!( | 
| 353 | "{} transactions offered, needed {}", | ||
| 354 | new_block.transaction_list.len(), | ||
| 355 | BLOCK_TRANSACTION_COUNT | ||
| 356 | ); | ||
| 347 | let res_json = warp::reply::json(&GradeCoinResponse { | 357 | let res_json = warp::reply::json(&GradeCoinResponse { | 
| 348 | res: ResponseType::Error, | 358 | res: ResponseType::Error, | 
| 349 | message: format!( | 359 | message: format!( | 
