Enforce Android lifecycle and presentation security (#100)
This commit is contained in:
1 parent
c0ba6d43d8
commit
a06f39af23
37 files changed
+1129
-110
No files matched your search
@@ -282,6 +282,8 @@ pub enum MobileLifecycleEvent {
|
||||
Foreground,
|
||||
Background,
|
||||
DeviceLocked,
|
||||
MemoryPressure,
|
||||
ProcessRecreated,
|
||||
UserActivity,
|
||||
Cancel,
|
||||
}
|
||||
@@ -291,6 +293,8 @@ impl From<MobileLifecycleEvent> for storage::MobileLifecycleEvent {
|
||||
MobileLifecycleEvent::Foreground => Self::Foreground,
|
||||
MobileLifecycleEvent::Background => Self::Background,
|
||||
MobileLifecycleEvent::DeviceLocked => Self::DeviceLocked,
|
||||
MobileLifecycleEvent::MemoryPressure => Self::MemoryPressure,
|
||||
MobileLifecycleEvent::ProcessRecreated => Self::ProcessRecreated,
|
||||
MobileLifecycleEvent::UserActivity => Self::UserActivity,
|
||||
MobileLifecycleEvent::Cancel => Self::Cancel,
|
||||
}
|
||||
@@ -404,6 +408,21 @@ pub fn copy_mobile_entry_clearing(
|
||||
copy_entry(copy, clipboard, true)
|
||||
}
|
||||
|
||||
/// Revoke a copy while the Android window still has foreground clipboard access.
|
||||
#[uniffi::export]
|
||||
pub fn clear_mobile_entry_copy(
|
||||
copy: MobileEntryCopy,
|
||||
clipboard: Arc<dyn MobileClipboard>,
|
||||
) -> Result<(), MobilePlatformFfiError> {
|
||||
presentation::ClipboardManager::new(
|
||||
ClipboardAdapter(clipboard),
|
||||
presentation::ClipboardTimeout::default(),
|
||||
)
|
||||
.clear_current_copy(&SecretBytes::new(copy.value.into_bytes()))
|
||||
.map(|_| ())
|
||||
.map_err(|_| MobilePlatformFfiError::ClipboardFailed)
|
||||
}
|
||||
|
||||
fn copy_entry(
|
||||
copy: MobileEntryCopy,
|
||||
clipboard: Arc<dyn MobileClipboard>,
|
||||
|
||||
Reference in new issue
Block a user