mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 21:52:30 -04:00
crypto-ffi: Use proc-macros for VerificationRequest methods
This commit is contained in:
committed by
Jonas Platte
parent
5202e3e1b9
commit
27cf710009
@@ -139,35 +139,7 @@ callback interface QrCodeListener {
|
||||
void on_change(QrCodeState state);
|
||||
};
|
||||
|
||||
interface VerificationRequest {
|
||||
string other_user_id();
|
||||
string? other_device_id();
|
||||
string flow_id();
|
||||
string? room_id();
|
||||
boolean we_started();
|
||||
boolean is_ready();
|
||||
boolean is_done();
|
||||
boolean is_passive();
|
||||
boolean is_cancelled();
|
||||
CancelInfo? cancel_info();
|
||||
|
||||
sequence<string>? their_supported_methods();
|
||||
sequence<string>? our_supported_methods();
|
||||
|
||||
OutgoingVerificationRequest? accept(sequence<string> methods);
|
||||
|
||||
[Throws=CryptoStoreError]
|
||||
StartSasResult? start_sas_verification();
|
||||
|
||||
[Throws=CryptoStoreError]
|
||||
QrCode? start_qr_verification();
|
||||
ScanResult? scan_qr_code([ByRef] string data);
|
||||
|
||||
OutgoingVerificationRequest? cancel();
|
||||
|
||||
void set_changes_listener(VerificationRequestListener listener);
|
||||
VerificationRequestState state();
|
||||
};
|
||||
interface VerificationRequest {};
|
||||
|
||||
[Enum]
|
||||
interface VerificationRequestState {
|
||||
|
||||
@@ -566,6 +566,7 @@ pub struct VerificationRequest {
|
||||
pub(crate) runtime: Handle,
|
||||
}
|
||||
|
||||
#[uniffi::export]
|
||||
impl VerificationRequest {
|
||||
/// The id of the other user that is participating in this verification
|
||||
/// request.
|
||||
@@ -712,7 +713,7 @@ impl VerificationRequest {
|
||||
///
|
||||
/// * `data` - The data that was extracted from the scanned QR code as an
|
||||
/// base64 encoded string, without padding.
|
||||
pub fn scan_qr_code(&self, data: &str) -> Option<ScanResult> {
|
||||
pub fn scan_qr_code(&self, data: String) -> Option<ScanResult> {
|
||||
let data = STANDARD_NO_PAD.decode(data).ok()?;
|
||||
let data = QrVerificationData::from_bytes(data).ok()?;
|
||||
|
||||
@@ -741,7 +742,9 @@ impl VerificationRequest {
|
||||
pub fn state(&self) -> VerificationRequestState {
|
||||
self.inner.state().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl VerificationRequest {
|
||||
async fn changes_listener(
|
||||
mut stream: impl Stream<Item = RustVerificationRequestState> + std::marker::Unpin,
|
||||
listener: Box<dyn VerificationRequestListener>,
|
||||
|
||||
Reference in New Issue
Block a user