Implement CameraX GPG QR transfer on Android (#106)
This commit is contained in:
1 parent
6669b77f4e
commit
d466b170ab
33 files changed
+1616
-162
No files matched your search
@@ -1581,6 +1581,10 @@ pub struct MobileKeyTransfer {
|
||||
|
||||
#[uniffi::export]
|
||||
impl MobileKeyTransfer {
|
||||
pub fn export_visible(&self) -> bool {
|
||||
self.service.export_visible()
|
||||
}
|
||||
|
||||
pub fn keys(&self) -> Vec<MobileKeyTransferKey> {
|
||||
self.service.keys().iter().map(Into::into).collect()
|
||||
}
|
||||
@@ -1635,6 +1639,31 @@ pub struct MobileKeyTransferImport {
|
||||
|
||||
#[uniffi::export]
|
||||
impl MobileKeyTransferImport {
|
||||
pub fn add_camera(
|
||||
&self,
|
||||
frame: platform::MobileCameraFrame,
|
||||
rotation_degrees: u32,
|
||||
) -> Result<Option<MobileKeyTransferProgress>, MobileKeyTransferFfiError> {
|
||||
self.importer
|
||||
.lock()
|
||||
.map_err(|_| MobileKeyTransferFfiError::Failed {
|
||||
kind: MobileKeyTransferErrorKind::Failed,
|
||||
message: "the key-transfer session is unavailable".to_owned(),
|
||||
})?
|
||||
.add_camera(
|
||||
ironstorage::mobile_platform::MobileCameraFrame {
|
||||
luminance: ironstorage::repository::SecretBytes::new(frame.luminance),
|
||||
width: frame.width,
|
||||
height: frame.height,
|
||||
row_stride: frame.row_stride,
|
||||
pixel_stride: frame.pixel_stride,
|
||||
},
|
||||
rotation_degrees,
|
||||
)
|
||||
.map(|progress| progress.map(Into::into))
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn add_image(
|
||||
&self,
|
||||
image: Vec<u8>,
|
||||
|
||||
Reference in new issue
Block a user