vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 6378d96d1ab26d84bc78d3e0e17294db9bf0a13b
parent c722256cbdb6fb1dddbabe6023431d10a463c4d4
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Fri, 13 Jul 2018 11:07:20 +0200

Add some extra debug prints

Diffstat:
Msrc/api/core/two_factor.rs | 25++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/api/core/two_factor.rs b/src/api/core/two_factor.rs @@ -269,12 +269,17 @@ fn activate_u2f(data: JsonUpcase<EnableU2FData>, headers: Headers, conn: DbConn) ); if let Some(tf_challenge) = tf_challenge { - let challenge: Challenge = serde_json::from_str(&tf_challenge.data).unwrap(); + let challenge: Challenge = serde_json::from_str(&tf_challenge.data) + .expect("Can't parse U2fRegisterChallenge data"); + tf_challenge .delete(&conn) .expect("Error deleting U2F register challenge"); - let response: RegisterResponse = serde_json::from_str(&data.DeviceResponse).unwrap(); + println!("RegisterResponse {:#?}", &data.DeviceResponse); + + let response: RegisterResponse = + serde_json::from_str(&data.DeviceResponse).expect("Can't parse DeviceResponse data"); match U2F.register_response(challenge.clone(), response) { Ok(registration) => { @@ -349,7 +354,9 @@ impl Into<Registration> for RegistrationCopy { } fn _parse_registrations(registations: &str) -> Vec<Registration> { - let registrations_copy: Vec<RegistrationCopy> = serde_json::from_str(registations).unwrap(); + println!("Registrations {:#?}", registations); + let registrations_copy: Vec<RegistrationCopy> = + serde_json::from_str(registations).expect("Can't parse RegistrationCopy data"); registrations_copy.into_iter().map(Into::into).collect() } @@ -377,7 +384,10 @@ pub fn validate_u2f_login(user_uuid: &str, response: &str, conn: &DbConn) -> Api let challenge = match tf_challenge { Some(tf_challenge) => { - let challenge: Challenge = serde_json::from_str(&tf_challenge.data).unwrap(); + println!("challenge {:#?}", &tf_challenge.data); + + let challenge: Challenge = serde_json::from_str(&tf_challenge.data) + .expect("Can't parse U2fLoginChallenge data"); tf_challenge .delete(&conn) .expect("Error deleting U2F login challenge"); @@ -395,11 +405,8 @@ pub fn validate_u2f_login(user_uuid: &str, response: &str, conn: &DbConn) -> Api println!("response {:#?}", response); - let response: SignResponse = serde_json::from_str(response).unwrap(); - - println!("client_data {:#?}", response.client_data); - println!("key_handle {:#?}", response.key_handle); - println!("signature_data {:#?}", response.signature_data); + let response: SignResponse = + serde_json::from_str(response).expect("Can't parse SignResponse data"); let mut _counter: u32 = 0; for registration in registrations {