Files
nkode-protocol/src/models/opaque.rs
2025-12-14 11:49:50 -06:00

37 lines
1.1 KiB
Rust

use opaque_ke::{Ristretto255, TripleDh, ServerSetup, CredentialResponse, RegistrationUploadLen, RegistrationResponse};
use opaque_ke::keypair::{OprfSeed, PrivateKey};
use sha2::Sha512;
use opaque_ke::CipherSuite;
use opaque_ke::argon2::Argon2;
use opaque_ke::generic_array::GenericArray;
use uuid::Uuid;
pub const NONCE_SIZE: usize = 12;
pub const SESSION_KEY_SIZE: usize = 32;
pub const SECRET_KEY_SIZE: usize = 16;
pub struct NKodeCipherSuite;
impl CipherSuite for NKodeCipherSuite {
type OprfCs = Ristretto255;
type KeyExchange = TripleDh<Ristretto255, Sha512>;
type Ksf = Argon2<'static>;
}
pub type NKodeServerSetup = ServerSetup<NKodeCipherSuite, PrivateKey<Ristretto255>, OprfSeed<Sha512>>;
pub type PasswordFile = GenericArray<u8, RegistrationUploadLen<NKodeCipherSuite>>;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LoginSession {
pub response: CredentialResponse<NKodeCipherSuite>,
pub session_id: Uuid
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RegisterSession {
pub response: RegistrationResponse<NKodeCipherSuite>,
pub session_id: Uuid
}