1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pub mod client {
    use crate::{config::opaque::OpaqueCipherSuite, types::database::account::AccountName};
    use opaque_ke::{CredentialFinalization, CredentialRequest};
    use serde::{Deserialize, Serialize};

    #[derive(Debug, Deserialize, Serialize)]
    /// Pass account name and registration-start message from OPAQUE.
    pub struct AuthenticateStart {
        pub credential_request: CredentialRequest<OpaqueCipherSuite>,
        pub account_name: AccountName,
    }

    #[derive(Debug, Deserialize, Serialize)]
    /// Pass account name and registration-finish message from OPAQUE.
    pub struct AuthenticateFinish {
        pub credential_finalization: CredentialFinalization<OpaqueCipherSuite>,
    }
}

pub mod server {
    use crate::config::opaque::OpaqueCipherSuite;
    use opaque_ke::CredentialResponse;
    use serde::{Deserialize, Serialize};
    use uuid::Uuid;

    #[derive(Debug, Deserialize, Serialize)]
    /// Check if user exists and return OPAQUE message if so
    pub struct AuthenticateStart {
        pub credential_response: CredentialResponse<OpaqueCipherSuite>,
    }

    #[derive(Debug, Deserialize, Serialize)]
    /// Return true if successful.
    pub struct AuthenticateFinish {
        pub session_id: Uuid,
    }
}