Show TOTP codes in password details (#75)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user