Show TOTP codes in password details (#75)

This commit is contained in:
2026-08-11 23:40:24 +02:00
parent 9759162eff
commit 2026637a0e
9 changed files with 640 additions and 110 deletions

View File

@@ -16,7 +16,7 @@ use ironstorage::{
MobileAuthenticationError as StorageAuthenticationError,
MobileAuthenticationErrorKind as StorageAuthenticationErrorKind,
MobileAuthenticationState as StorageAuthenticationState,
MobileEntryCopy as StorageEntryCopy,
MobileEntryCopy as StorageEntryCopy, MobileEntryPresentation as StorageEntryPresentation,
},
mobile_entry::{
MobileEntryEditorFieldKind as StorageEntryEditorFieldKind,
@@ -923,6 +923,24 @@ impl From<StorageTotpDetail> for MobileTotpDetail {
}
}
#[derive(Clone, uniffi::Record)]
pub struct MobileEntryPresentation {
pub page: MobileEntryPage,
pub totp: Option<MobileTotpDetail>,
pub cache_notice: Option<String>,
}
impl From<StorageEntryPresentation> for MobileEntryPresentation {
fn from(presentation: StorageEntryPresentation) -> Self {
let (page, totp, cache_notice) = presentation.into_parts();
Self {
page: page.into(),
totp: totp.map(Into::into),
cache_notice,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, uniffi::Enum)]
pub enum MobileEntryEditorFieldKind {
Password,
@@ -1344,9 +1362,10 @@ impl MobileAuthentication {
pub fn entry_page(
&self,
path: String,
) -> Result<MobileEntryPage, MobileAuthenticationFfiError> {
unix_seconds: u64,
) -> Result<MobileEntryPresentation, MobileAuthenticationFfiError> {
self.authentication
.entry_page(&path)
.entry_page(&path, unix_seconds)
.map(Into::into)
.map_err(Into::into)
}