implement signed session data

This commit is contained in:
2025-12-18 15:11:42 -06:00
parent c24b254b22
commit 88656fefac
23 changed files with 384 additions and 76 deletions

View File

@@ -4,8 +4,8 @@ use nkode_rs::nkode_core::keypad::Keypad;
use nkode_rs::nkode_core::nkode_cipher::NKodeCipher;
use nkode_rs::from_bytes::FromBytes;
use crate::shared::models::app::{AuthAPI, CodeLoggedInSession, CodeLoginData, Icon, IconID, KeyLoggedInSession, ICON_ID_SIZE};
use crate::shared::models::email::Email;
use crate::shared::models::opaque::UserSecretKey;
use crate::shared::email::Email;
use crate::shared::opaque::UserSecretKey;
struct KeyLogin;
@@ -68,7 +68,7 @@ impl <S: AuthAPI> UserStateKeyLoggedIn<S> {
async fn get_icons(&self, icon_nonce: &Nonce) -> Result<Vec<Icon>, String> {
let chacha20_key = self.user_secret_key.chacha20_secret_key();
let mut chacha_cipher = nkode_rs::nkode_core::chacha20prng::ChaCha20PRNG::new(&chacha20_key, icon_nonce);
let mut icons = self.api.get_new_icons(&self.key_login).await?;
let mut icons = self.api.get_new_icons().await?;
for icon in &mut icons {
let bytes = chacha_cipher.read_u8(ICON_ID_SIZE)?;
let new_id = IconID::from_bytes(bytes.as_slice()).unwrap();
@@ -123,7 +123,7 @@ impl <S: AuthAPI> UserStateCodeRegister<S> {
icon_nonce: self.icon_nonce,
keypad,
};
self.api.register_code(&self.email, &ciphered_nkode.passcode, &self.key_login, &data).await?;
self.api.register_code(&self.email, &ciphered_nkode.passcode, &self.key_login, data.clone()).await?;
Ok(UserStateCodeLogin {
api: self.api,
mask: data.mask,