Use our omemo sid/fingerprint in qr code

Current clients sid/fingerprint will be shown in following format:
`xmpp:<user@server>?omemo-sid-<numerical-sid>=<omemo-fingerprint-hex-string>`

Fix https://github.com/profanity-im/profanity/issues/1320
This commit is contained in:
Michael Vetter
2022-05-31 15:44:44 +02:00
parent 754c110a34
commit 2e85f18cd6
7 changed files with 33 additions and 5 deletions

View File

@@ -1896,3 +1896,21 @@ out:
curl_url_cleanup(url);
return ret;
}
/* returns a string in the format `xmpp:<user@server>?omemo-sid-<numerical-sid>=<omemo-fingerprint-hex-string>`
* used for verification over QR codes
*/
char*
omemo_qrcode_str()
{
char* mybarejid = connection_get_barejid();
char* fingerprint = omemo_own_fingerprint(TRUE);
uint32_t sid = omemo_device_id();
char* qrstr = g_strdup_printf("xmpp:%s?omemo-sid-%d=%s", mybarejid, sid, fingerprint);
free(mybarejid);
free(fingerprint);
return qrstr;
}

View File

@@ -105,3 +105,5 @@ char* omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res);
gcry_error_t omemo_decrypt_file(FILE* in, FILE* out, off_t file_size, const char* fragment);
void omemo_free(void* a);
int omemo_parse_aesgcm_url(const char* aesgcm_url, char** https_url, char** fragment);
char* omemo_qrcode_str();