mtx::crypto::SAS struct

Helper to generate Short Authentication Strings (SAS)

Constructors, destructors, conversion operators

SAS()
Create a new SAS object.

Public functions

auto public_key() -> std::string
Query the public key generated for this object.
void set_their_key(const std::string& their_public_key)
Set the key of the other party being verified.
auto generate_bytes_decimal(const std::string& info) -> std::vector<int>
Returns 3 integers ranging from 1000 to 9191, to be used only after using set_their_key
auto generate_bytes_emoji(const std::string& info) -> std::vector<int>
Returns 7 integers in the range from 0 to 63, to be used only after using set_their_key
auto calculate_mac(std::string_view mac_version, const mtx::identifiers::User& sender, const std::string& senderDevice, const mtx::identifiers::User& receiver, const std::string& receiverDevice, const std::string& transactionId, const std::map<std::string, std::string>& keys) -> mtx::events::msg::KeyVerificationMac
Calculate MACs after verification to verify keys. mac_version is either hkdf-hmac-sha256 or hkdf-hmac-sha256.v2 keys are the keys to verify. Transaction id is the transaction id of the current verification exchange. *Device are the device ids of the respective senders.

Function documentation

std::vector<int> mtx::crypto::SAS::generate_bytes_decimal(const std::string& info)

Returns 3 integers ranging from 1000 to 9191, to be used only after using set_their_key

These are meant to be compared by the users verifying each other.

std::vector<int> mtx::crypto::SAS::generate_bytes_emoji(const std::string& info)

Returns 7 integers in the range from 0 to 63, to be used only after using set_their_key

Map these numpers to one of the 64 emoji from the specification and let the user compare them.