You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
928 B
41 lines
928 B
//! Authentication
|
|
use super::*;
|
|
|
|
pub struct Sha256Hash(pub sha256::Sha256Hash);
|
|
type RsaSignature = rsa::Signature;
|
|
|
|
impl str::FromStr for Sha256Hash
|
|
{
|
|
type Err = ();
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
todo!() //read encoded base64(?)/hex into `Signature`
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AuthRequest
|
|
{
|
|
id: uuid::Uuid,
|
|
sign_this: [u8; 32],
|
|
salt: [u8; 16],
|
|
passwd_is_allowed: bool,
|
|
}
|
|
|
|
pub async fn auth_req(who: source::IpAddr, state: Arc<state::State>) -> Result<AuthRequest, Infallible>
|
|
{
|
|
|
|
todo!()
|
|
}
|
|
|
|
pub async fn auth_key(who: source::IpAddr, state: Arc<state::State>, req_id: uuid::Uuid, num: usize, body: Bytes) -> Result<(), Infallible>
|
|
{
|
|
|
|
Ok(())
|
|
}
|
|
|
|
pub async fn auth_pass(who: source::IpAddr, state: Arc<state::State>, req_id: uuid::Uuid, passhash: sha256::Sha256Hash) -> Result<(), Infallible>
|
|
{
|
|
|
|
Ok(())
|
|
}
|