[Add] basic split
This commit is contained in:
parent
a0ff6b1082
commit
3cdf7c62d5
77 changed files with 506 additions and 648 deletions
18
decentralized/src/local-auth/local_auth.rs
Normal file
18
decentralized/src/local-auth/local_auth.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use json::JsonValue;
|
||||
|
||||
use crate::util::file_util::load_file;
|
||||
// NOT USED AT MOMENT
|
||||
pub fn is_private_key_valid(user_id: &i64, key_hash: &str) -> bool {
|
||||
let file_contents = load_file("", "users.json");
|
||||
|
||||
let users = json::parse(&file_contents).unwrap();
|
||||
if let JsonValue::Array(users_array) = users {
|
||||
for user in users_array {
|
||||
if user["uuid"] == user_id.to_string() && user["private_key_hash"] == key_hash {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
Loading…
Reference in a new issue