|
|
|
@ -12,10 +12,11 @@ impl str::FromStr for Sha256Hash
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
pub struct AuthRequest
|
|
|
|
|
{
|
|
|
|
|
id: uuid::Uuid,
|
|
|
|
|
|
|
|
|
|
sign_this: [u8; 32],
|
|
|
|
|
salt: [u8; 16],
|
|
|
|
|
passwd_is_allowed: bool,
|
|
|
|
@ -45,7 +46,7 @@ pub async fn auth_req(who: source::IpAddr, state: Arc<state::State>) -> Result<A
|
|
|
|
|
let req = AuthRequest::new(state.cfg());
|
|
|
|
|
trace!("{:?} auth req", who);
|
|
|
|
|
|
|
|
|
|
// TODO: Add `req` into `state` somehow for later.
|
|
|
|
|
// TODO: Add `req` into `state` auth hashmap (`req.id` is key) for verification.
|
|
|
|
|
// TODO: Use `DelayQueue` to remove `req.id` from the hashmap after `ttl` expires.
|
|
|
|
|
Ok(req)
|
|
|
|
|
}
|
|
|
|
|