From 6b2d49acb884816318b71a49c25d999512ce1261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= <39526136+Septias@users.noreply.github.com> Date: Sun, 10 Nov 2024 23:30:43 +0100 Subject: [PATCH] Copy over some docs as requested in the associated issue. (#6193) Copy over some docs as requested in the associated issue. close #5503 --- deltachat-jsonrpc/src/api/types/qr.rs | 95 +++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 11 deletions(-) diff --git a/deltachat-jsonrpc/src/api/types/qr.rs b/deltachat-jsonrpc/src/api/types/qr.rs index 72ac25ee00..c2588ee484 100644 --- a/deltachat-jsonrpc/src/api/types/qr.rs +++ b/deltachat-jsonrpc/src/api/types/qr.rs @@ -6,87 +6,161 @@ use typescript_type_def::TypeDef; #[serde(rename = "Qr", rename_all = "camelCase")] #[serde(tag = "kind")] pub enum QrObject { + /// Ask the user whether to verify the contact. + /// + /// If the user agrees, pass this QR code to [`crate::securejoin::join_securejoin`]. AskVerifyContact { + /// ID of the contact. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, + /// Ask the user whether to join the group. AskVerifyGroup { + /// Group name. grpname: String, + /// Group ID. grpid: String, + /// ID of the contact. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, + /// Contact fingerprint is verified. + /// + /// Ask the user if they want to start chatting. FprOk { + /// Contact ID. contact_id: u32, }, + /// Scanned fingerprint does not match the last seen fingerprint. FprMismatch { + /// Contact ID. contact_id: Option, }, + /// The scanned QR code contains a fingerprint but no e-mail address. FprWithoutAddr { + /// Key fingerprint. fingerprint: String, }, + /// Ask the user if they want to create an account on the given domain. Account { + /// Server domain name. domain: String, }, + /// Provides a backup that can be retrieved using iroh-net based backup transfer protocol. Backup2 { + /// Authentication token. auth_token: String, - + /// Iroh node address. node_addr: String, }, + /// Ask the user if they want to use the given service for video chats. WebrtcInstance { domain: String, instance_pattern: String, }, + /// Ask the user if they want to use the given proxy. + /// + /// Note that HTTP(S) URLs without a path + /// and query parameters are treated as HTTP(S) proxy URL. + /// UI may want to still offer to open the URL + /// in the browser if QR code contents + /// starts with `http://` or `https://` + /// and the QR code was not scanned from + /// the proxy configuration screen. Proxy { + /// Proxy URL. + /// + /// This is the URL that is going to be added. url: String, + /// Host extracted from the URL to display in the UI. host: String, + /// Port extracted from the URL to display in the UI. port: u16, }, + /// Contact address is scanned. + /// + /// Optionally, a draft message could be provided. + /// Ask the user if they want to start chatting. Addr { + /// Contact ID. contact_id: u32, + /// Draft message. draft: Option, }, - Url { - url: String, - }, - Text { - text: String, - }, + /// URL scanned. + /// + /// Ask the user if they want to open a browser or copy the URL to clipboard. + Url { url: String }, + /// Text scanned. + /// + /// Ask the user if they want to copy the text to clipboard. + Text { text: String }, + /// Ask the user if they want to withdraw their own QR code. WithdrawVerifyContact { + /// Contact ID. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, + /// Ask the user if they want to withdraw their own group invite QR code. WithdrawVerifyGroup { + /// Group name. grpname: String, + /// Group ID. grpid: String, + /// Contact ID. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, + /// Ask the user if they want to revive their own QR code. ReviveVerifyContact { + /// Contact ID. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, + /// Ask the user if they want to revive their own group invite QR code. ReviveVerifyGroup { + /// Contact ID. grpname: String, + /// Group ID. grpid: String, + /// Contact ID. contact_id: u32, + /// Fingerprint of the contact key as scanned from the QR code. fingerprint: String, + /// Invite number. invitenumber: String, + /// Authentication code. authcode: String, }, - Login { - address: String, - }, + /// `dclogin:` scheme parameters. + /// + /// Ask the user if they want to login with the email address. + Login { address: String }, } impl From for QrObject { @@ -141,7 +215,6 @@ impl From for QrObject { auth_token, } => QrObject::Backup2 { node_addr: serde_json::to_string(node_addr).unwrap_or_default(), - auth_token, }, Qr::WebrtcInstance {