refactor(bindings): Use UniFFI proc-macros for CrossSigningStatus

This commit is contained in:
Jonas Platte
2022-10-06 22:43:42 +02:00
committed by Jonas Platte
parent 5a62ec3fc1
commit fe7f157253
3 changed files with 13 additions and 17 deletions

View File

@@ -484,7 +484,7 @@ pub struct DecryptedEvent {
/// Struct representing the state of our private cross signing keys, it shows
/// which private cross signing keys we have locally stored.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, uniffi::Record)]
pub struct CrossSigningStatus {
/// Do we have the master key.
pub has_master: bool,
@@ -602,7 +602,7 @@ mod uniffi_types {
error::CryptoStoreError,
machine::OlmMachine,
responses::Request,
BackupKeys, RoomKeyCounts,
BackupKeys, CrossSigningStatus, RoomKeyCounts,
};
}

View File

@@ -149,6 +149,17 @@ impl OlmMachine {
}
}
#[uniffi::export]
impl OlmMachine {
/// Get the status of the private cross signing keys.
///
/// This can be used to check which private cross signing keys we have
/// stored locally.
pub fn cross_signing_status(&self) -> CrossSigningStatus {
self.runtime.block_on(self.inner.cross_signing_status()).into()
}
}
impl OlmMachine {
/// Create a new `OlmMachine`
///
@@ -1125,14 +1136,6 @@ impl OlmMachine {
Ok(self.runtime.block_on(self.inner.bootstrap_cross_signing(true))?.into())
}
/// Get the status of the private cross signing keys.
///
/// This can be used to check which private cross signing keys we have
/// stored locally.
pub fn cross_signing_status(&self) -> CrossSigningStatus {
self.runtime.block_on(self.inner.cross_signing_status()).into()
}
/// Export all our private cross signing keys.
///
/// The export will contain the seed for the ed25519 keys as a base64

View File

@@ -110,12 +110,6 @@ interface UserIdentity {
);
};
dictionary CrossSigningStatus {
boolean has_master;
boolean has_self_signing;
boolean has_user_signing;
};
dictionary CrossSigningKeyExport {
string? master_key;
string? self_signing_key;
@@ -449,7 +443,6 @@ interface OlmMachine {
[Throws=CryptoStoreError]
void discard_room_key([ByRef] string room_id);
CrossSigningStatus cross_signing_status();
[Throws=CryptoStoreError]
BootstrapCrossSigningResult bootstrap_cross_signing();
CrossSigningKeyExport? export_cross_signing_keys();