text stringlengths 0 357 |
|---|
msg->text = dc_mprintf("Secure-Join: %s", step); |
msg->hidden = 1; |
dc_param_set_int(msg->param, DC_PARAM_CMD, DC_CMD_SECUREJOIN_MESSAGE); |
dc_param_set (msg->param, DC_PARAM_CMD_ARG, step); |
if (param2) { |
dc_param_set(msg->param, DC_PARAM_CMD_ARG2, param2); // depening on step, this goes either to Secure-Join-Invitenumber or Secure-Join-Auth in mrmimefactory.c |
} |
if (fingerprint) { |
dc_param_set(msg->param, DC_PARAM_CMD_ARG3, fingerprint); |
} |
if (grpid) { |
dc_param_set(msg->param, DC_PARAM_CMD_ARG4, grpid); |
} |
if (strcmp(step, "vg-request")==0 || strcmp(step, "vc-request")==0) { |
dc_param_set_int(msg->param, DC_PARAM_FORCE_PLAINTEXT, DC_FP_ADD_AUTOCRYPT_HEADER); // the request message MUST NOT be encrypted - it may be that the key has changed and the message cannot be decrypted otherwise |
} |
else { |
dc_param_set_int(msg->param, DC_PARAM_GUARANTEE_E2EE, 1); /* all but the first message MUST be encrypted */ |
} |
dc_send_msg(context, contact_chat_id, msg); |
dc_msg_unref(msg); |
} |
static void could_not_establish_secure_connection(dc_context_t* context, uint32_t contact_chat_id, const char* details) |
{ |
uint32_t contact_id = chat_id_2_contact_id(context, contact_chat_id); |
dc_contact_t* contact = dc_get_contact(context, contact_id); |
char* msg = dc_stock_str_repl_string(context, DC_STR_CONTACT_NOT_VERIFIED, contact? contact->addr : "?"); |
dc_add_device_msg(context, contact_chat_id, msg); |
dc_log_error(context, 0, "%s (%s)", msg, details); // additionaly raise an error; this typically results in a toast (inviter side) or a dialog (joiner side) |
free(msg); |
dc_contact_unref(contact); |
} |
static void secure_connection_established(dc_context_t* context, uint32_t contact_chat_id) |
{ |
uint32_t contact_id = chat_id_2_contact_id(context, contact_chat_id); |
dc_contact_t* contact = dc_get_contact(context, contact_id); |
char* msg = dc_stock_str_repl_string(context, DC_STR_CONTACT_VERIFIED, contact? contact->addr : "?"); |
dc_add_device_msg(context, contact_chat_id, msg); |
// in addition to DC_EVENT_MSGS_CHANGED (sent by dc_add_device_msg()), also send DC_EVENT_CHAT_MODIFIED to update all views |
context->cb(context, DC_EVENT_CHAT_MODIFIED, contact_chat_id, 0); |
free(msg); |
dc_contact_unref(contact); |
} |
static void end_bobs_joining(dc_context_t* context, int status) |
{ |
context->bobs_status = status; |
dc_stop_ongoing_process(context); |
} |
/******************************************************************************* |
* Secure-join main flow |
******************************************************************************/ |
/** |
* Get QR code text that will offer an secure-join verification. |
* The QR code is compatible to the OPENPGP4FPR format |
* so that a basic fingerprint comparison also works eg. with OpenKeychain. |
* |
* The scanning device will pass the scanned content to dc_check_qr() then; |
* if this function returns DC_QR_ASK_VERIFYCONTACT or DC_QR_ASK_VERIFYGROUP |
* an out-of-band-verification can be joined using dc_join_securejoin() |
* |
* @memberof dc_context_t |
* @param context The context object. |
* @param group_chat_id If set to a group-chat-id, |
* the group-join-protocol is offered in the QR code; |
* works for verified groups as well as for normal groups. |
* If set to 0, the setup-Verified-contact-protocol is offered in the QR code. |
* @return Text that should go to the QR code, |
* On errors, an empty QR code is returned, NULL is never returned. |
* The returned string must be free()'d after usage. |
*/ |
char* dc_get_securejoin_qr(dc_context_t* context, uint32_t group_chat_id) |
{ |
/* ========================================================= |
==== Alice - the inviter side ==== |
==== Step 1 in "Setup verified contact" protocol ==== |
========================================================= */ |
char* qr = NULL; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.