Copy over some docs as requested in the associated issue. (#6193)

Copy over some docs as requested in the associated issue.

close #5503
This commit is contained in:
Sebastian Klähn
2024-11-10 23:30:43 +01:00
committed by GitHub
parent 3b2f18f926
commit 6b2d49acb8

View File

@@ -6,87 +6,161 @@ use typescript_type_def::TypeDef;
#[serde(rename = "Qr", rename_all = "camelCase")] #[serde(rename = "Qr", rename_all = "camelCase")]
#[serde(tag = "kind")] #[serde(tag = "kind")]
pub enum QrObject { 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 { AskVerifyContact {
/// ID of the contact.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
/// Ask the user whether to join the group.
AskVerifyGroup { AskVerifyGroup {
/// Group name.
grpname: String, grpname: String,
/// Group ID.
grpid: String, grpid: String,
/// ID of the contact.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
/// Contact fingerprint is verified.
///
/// Ask the user if they want to start chatting.
FprOk { FprOk {
/// Contact ID.
contact_id: u32, contact_id: u32,
}, },
/// Scanned fingerprint does not match the last seen fingerprint.
FprMismatch { FprMismatch {
/// Contact ID.
contact_id: Option<u32>, contact_id: Option<u32>,
}, },
/// The scanned QR code contains a fingerprint but no e-mail address.
FprWithoutAddr { FprWithoutAddr {
/// Key fingerprint.
fingerprint: String, fingerprint: String,
}, },
/// Ask the user if they want to create an account on the given domain.
Account { Account {
/// Server domain name.
domain: String, domain: String,
}, },
/// Provides a backup that can be retrieved using iroh-net based backup transfer protocol.
Backup2 { Backup2 {
/// Authentication token.
auth_token: String, auth_token: String,
/// Iroh node address.
node_addr: String, node_addr: String,
}, },
/// Ask the user if they want to use the given service for video chats.
WebrtcInstance { WebrtcInstance {
domain: String, domain: String,
instance_pattern: 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 {
/// Proxy URL.
///
/// This is the URL that is going to be added.
url: String, url: String,
/// Host extracted from the URL to display in the UI.
host: String, host: String,
/// Port extracted from the URL to display in the UI.
port: u16, port: u16,
}, },
/// Contact address is scanned.
///
/// Optionally, a draft message could be provided.
/// Ask the user if they want to start chatting.
Addr { Addr {
/// Contact ID.
contact_id: u32, contact_id: u32,
/// Draft message.
draft: Option<String>, draft: Option<String>,
}, },
Url { /// URL scanned.
url: String, ///
}, /// Ask the user if they want to open a browser or copy the URL to clipboard.
Text { Url { url: String },
text: 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 { WithdrawVerifyContact {
/// Contact ID.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
/// Ask the user if they want to withdraw their own group invite QR code.
WithdrawVerifyGroup { WithdrawVerifyGroup {
/// Group name.
grpname: String, grpname: String,
/// Group ID.
grpid: String, grpid: String,
/// Contact ID.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
/// Ask the user if they want to revive their own QR code.
ReviveVerifyContact { ReviveVerifyContact {
/// Contact ID.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
/// Ask the user if they want to revive their own group invite QR code.
ReviveVerifyGroup { ReviveVerifyGroup {
/// Contact ID.
grpname: String, grpname: String,
/// Group ID.
grpid: String, grpid: String,
/// Contact ID.
contact_id: u32, contact_id: u32,
/// Fingerprint of the contact key as scanned from the QR code.
fingerprint: String, fingerprint: String,
/// Invite number.
invitenumber: String, invitenumber: String,
/// Authentication code.
authcode: String, authcode: String,
}, },
Login { /// `dclogin:` scheme parameters.
address: String, ///
}, /// Ask the user if they want to login with the email address.
Login { address: String },
} }
impl From<Qr> for QrObject { impl From<Qr> for QrObject {
@@ -141,7 +215,6 @@ impl From<Qr> for QrObject {
auth_token, auth_token,
} => QrObject::Backup2 { } => QrObject::Backup2 {
node_addr: serde_json::to_string(node_addr).unwrap_or_default(), node_addr: serde_json::to_string(node_addr).unwrap_or_default(),
auth_token, auth_token,
}, },
Qr::WebrtcInstance { Qr::WebrtcInstance {