-
Notifications
You must be signed in to change notification settings - Fork 232
Md5 auth #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Md5 auth #55
Conversation
Left to figure out: Whats the right format to store user:pw in userlist? hashmap errors? actually do hash:x comparison
md5.update(salt.to_be_bytes().to_vec()); | ||
|
||
|
||
let password_string: String = String::from_utf8(password_hash).expect("Could not get password hash"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a panic, return an error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better yet, use String::from_utf8_lossy
which always returns successfully.
} | ||
}; | ||
|
||
let map: HashMap<String, String> = serde_json::from_str(&contents).expect("JSON was not well-formatted"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a panic, return an error instead.
@@ -94,6 +95,15 @@ async fn main() { | |||
} | |||
}; | |||
|
|||
// Prepare user list | |||
match userlist::parse("userlist.json").await { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this typed. Checkout the example in config.rs
where we used TOML. The structure of the config file can be typed with a struct
, so when you parse it you can detect errors & also you won't have to check for them when you use the config elsewhere in the code.
Implemented in #77 |
Left to figure out:
Whats the right format to store user:pw in userlist?
hashmap errors?
actually do hash comparison