From 1cb96758a9fb5eb267c142a2b6f7893cb1f05bcc Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Sat, 5 Oct 2024 14:17:56 +0000 Subject: [PATCH] rename session methods --- include/dpp/discordvoiceclient.h | 4 +- src/dpp/dave/session.cpp | 106 ++++++++++++------------- src/dpp/dave/session.h | 60 +++++++------- src/dpp/discordvoiceclient.cpp | 4 +- src/dpp/voice/enabled/handle_frame.cpp | 32 ++++---- 5 files changed, 103 insertions(+), 103 deletions(-) diff --git a/include/dpp/discordvoiceclient.h b/include/dpp/discordvoiceclient.h index 7777750e0b..98bd9f2763 100644 --- a/include/dpp/discordvoiceclient.h +++ b/include/dpp/discordvoiceclient.h @@ -200,7 +200,7 @@ struct dave_binary_header_t { [[nodiscard]] std::vector get_data(size_t length) const; /** - * Get the data package from the packed binary frame for ProcessWelcome, + * Get the data package from the packed binary frame for process_welcome, * as a vector of uint8_t for use in the libdave functions. * * @param length Length of the data, use the websocket frame size here @@ -209,7 +209,7 @@ struct dave_binary_header_t { [[nodiscard]] std::vector get_welcome_data(size_t length) const; /** - * Get transition ID for ProcessWelcome + * Get transition ID for process_welcome * * @return Transition ID */ diff --git a/src/dpp/dave/session.cpp b/src/dpp/dave/session.cpp index 4da06f3bb9..011c41ac50 100755 --- a/src/dpp/dave/session.cpp +++ b/src/dpp/dave/session.cpp @@ -68,30 +68,30 @@ session::session(key_pair_context_type context, session::~session() noexcept = default; -void session::Init(protocol_version protocolVersion, +void session::init(protocol_version version, uint64_t groupId, std::string const& selfUserId, std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept { - Reset(); + reset(); selfUserId_ = selfUserId; - DISCORD_LOG(LS_INFO) << "Initializing MLS session with protocol version " << protocolVersion - << " and group ID " << groupId; - protocolVersion_ = protocolVersion; + DISCORD_LOG(LS_INFO) << "Initializing MLS session with protocol version " << version + << " and group ID " << groupId; + protocolVersion_ = version; groupId_ = std::move(BigEndianBytesFrom(groupId).as_vec()); - InitLeafNode(selfUserId, transientKey); + init_leaf_node(selfUserId, transientKey); - CreatePendingGroup(); + create_pending_group(); } -void session::Reset() noexcept +void session::reset() noexcept { DISCORD_LOG(LS_INFO) << "Resetting MLS session"; - ClearPendingState(); + clear_pending_state(); currentState_.reset(); outboundCachedGroupState_.reset(); @@ -100,7 +100,7 @@ void session::Reset() noexcept groupId_.clear(); } -void session::SetProtocolVersion(protocol_version version) noexcept +void session::set_protocol_version(protocol_version version) noexcept { if (version != protocolVersion_) { // when we need to retain backwards compatibility @@ -110,7 +110,7 @@ void session::SetProtocolVersion(protocol_version version) noexcept } } -std::vector session::GetLastEpochAuthenticator() const noexcept +std::vector session::get_last_epoch_authenticator() const noexcept { if (!currentState_) { DISCORD_LOG(LS_ERROR) << "Cannot get epoch authenticator without an established MLS group"; @@ -120,7 +120,7 @@ std::vector session::GetLastEpochAuthenticator() const noexcept return std::move(currentState_->epoch_authenticator().as_vec()); } -void session::SetExternalSender(const std::vector& marshalledExternalSender) noexcept +void session::set_external_sender(const std::vector &externalSenderPackage) noexcept try { if (currentState_) { DISCORD_LOG(LS_ERROR) << "Cannot set external sender after joining/creating an MLS group"; @@ -129,13 +129,13 @@ try { DISCORD_LOG(LS_INFO) << "Unmarshalling MLS external sender"; - DISCORD_LOG(LS_INFO) << "Sender: " << ::mlspp::bytes_ns::bytes(marshalledExternalSender); + DISCORD_LOG(LS_INFO) << "Sender: " << ::mlspp::bytes_ns::bytes(externalSenderPackage); externalSender_ = std::make_unique<::mlspp::ExternalSender>( - ::mlspp::tls::get<::mlspp::ExternalSender>(marshalledExternalSender)); + ::mlspp::tls::get<::mlspp::ExternalSender>(externalSenderPackage)); if (!groupId_.empty()) { - CreatePendingGroup(); + create_pending_group(); } } catch (const std::exception& e) { @@ -144,7 +144,7 @@ catch (const std::exception& e) { return; } -std::optional> session::ProcessProposals( +std::optional> session::process_proposals( std::vector proposals, std::set const& recognizedUserIDs) noexcept try { @@ -208,9 +208,9 @@ try { for (const auto& proposalMessage : messages) { auto validatedMessage = stateWithProposals_->unwrap(proposalMessage); - if (!ValidateProposalMessage(validatedMessage.authenticated_content(), - *stateWithProposals_, - recognizedUserIDs)) { + if (!validate_proposal_message(validatedMessage.authenticated_content(), + *stateWithProposals_, + recognizedUserIDs)) { return std::nullopt; } @@ -267,8 +267,8 @@ catch (const std::exception& e) { return std::nullopt; } -bool session::IsRecognizedUserID(const ::mlspp::Credential& cred, - std::set const& recognizedUserIDs) const +bool session::is_recognized_user_id(const ::mlspp::Credential& cred, + std::set const& recognizedUserIDs) const { std::string uid = UserCredentialToString(cred, protocolVersion_); if (uid.empty()) { @@ -284,9 +284,9 @@ bool session::IsRecognizedUserID(const ::mlspp::Credential& cred, return true; } -bool session::ValidateProposalMessage(::mlspp::AuthenticatedContent const& message, - ::mlspp::State const& targetState, - std::set const& recognizedUserIDs) const +bool session::validate_proposal_message(::mlspp::AuthenticatedContent const& message, + ::mlspp::State const& targetState, + std::set const& recognizedUserIDs) const { if (message.wire_format != ::mlspp::WireFormat::mls_public_message) { DISCORD_LOG(LS_ERROR) << "MLS proposal message must be PublicMessage"; @@ -302,7 +302,7 @@ bool session::ValidateProposalMessage(::mlspp::AuthenticatedContent const& messa } if (message.content.content_type() != ::mlspp::ContentType::proposal) { - DISCORD_LOG(LS_ERROR) << "ProcessProposals called with non-proposal message"; + DISCORD_LOG(LS_ERROR) << "process_proposals called with non-proposal message"; TRACK_MLS_ERROR("Unexpected message type"); return false; } @@ -318,7 +318,7 @@ bool session::ValidateProposalMessage(::mlspp::AuthenticatedContent const& messa case ::mlspp::ProposalType::add: { const auto& credential = ::mlspp::tls::var::get<::mlspp::Add>(proposal.content).key_package.leaf_node.credential; - if (!IsRecognizedUserID(credential, recognizedUserIDs)) { + if (!is_recognized_user_id(credential, recognizedUserIDs)) { DISCORD_LOG(LS_ERROR) << "MLS add proposal must be for recognized user"; TRACK_MLS_ERROR("Unexpected user ID in add proposal"); return false; @@ -337,7 +337,7 @@ bool session::ValidateProposalMessage(::mlspp::AuthenticatedContent const& messa return true; } -bool session::CanProcessCommit(const ::mlspp::MLSMessage& commit) noexcept +bool session::can_process_commit(const ::mlspp::MLSMessage& commit) noexcept { if (!stateWithProposals_) { return false; @@ -351,15 +351,15 @@ bool session::CanProcessCommit(const ::mlspp::MLSMessage& commit) noexcept return true; } -roster_variant session::ProcessCommit(std::vector commit) noexcept +roster_variant session::process_commit(std::vector commit) noexcept try { DISCORD_LOG(LS_INFO) << "Processing commit"; DISCORD_LOG(LS_INFO) << "Commit: " << ::mlspp::bytes_ns::bytes(commit); auto commitMessage = ::mlspp::tls::get<::mlspp::MLSMessage>(commit); - if (!CanProcessCommit(commitMessage)) { - DISCORD_LOG(LS_ERROR) << "ProcessCommit called with unprocessable MLS commit"; + if (!can_process_commit(commitMessage)) { + DISCORD_LOG(LS_ERROR) << "process_commit called with unprocessable MLS commit"; return ignored_t{}; } @@ -380,12 +380,12 @@ try { DISCORD_LOG(LS_INFO) << "Successfully processed MLS commit, updating state; our leaf index is " << newState->index().val << "; current epoch is " << newState->epoch(); - roster_map ret = ReplaceState(std::make_unique<::mlspp::State>(std::move(*newState))); + roster_map ret = replace_state(std::make_unique<::mlspp::State>(std::move(*newState))); // reset the outbound cached group since we handled the commit for this epoch outboundCachedGroupState_.reset(); - ClearPendingState(); + clear_pending_state(); return ret; } @@ -395,11 +395,11 @@ catch (const std::exception& e) { return failed_t{}; } -std::optional session::ProcessWelcome( +std::optional session::process_welcome( std::vector welcome, std::set const& recognizedUserIDs) noexcept try { - if (!HasCryptographicStateForWelcome()) { + if (!has_cryptographic_state_for_welcome()) { DISCORD_LOG(LS_ERROR) << "Missing local crypto state necessary to process MLS welcome"; return std::nullopt; } @@ -430,7 +430,7 @@ try { std::map<::mlspp::bytes_ns::bytes, ::mlspp::bytes_ns::bytes>()); // perform application-level verification of the new state - if (!VerifyWelcomeState(*newState, recognizedUserIDs)) { + if (!verify_welcome_state(*newState, recognizedUserIDs)) { DISCORD_LOG(LS_ERROR) << "Group received in MLS welcome is not valid"; return std::nullopt; @@ -440,10 +440,10 @@ try { << newState->index().val << "; current epoch is " << newState->epoch(); // make the verified state our new (and only) state - roster_map ret = ReplaceState(std::move(newState)); + roster_map ret = replace_state(std::move(newState)); // clear out any pending state for creating/joining a group - ClearPendingState(); + clear_pending_state(); return ret; } @@ -453,7 +453,7 @@ catch (const std::exception& e) { return std::nullopt; } -roster_map session::ReplaceState(std::unique_ptr<::mlspp::State>&& state) +roster_map session::replace_state(std::unique_ptr<::mlspp::State>&& state) { roster_map newRoster; for (const ::mlspp::LeafNode& node : state->roster()) { @@ -505,13 +505,13 @@ roster_map session::ReplaceState(std::unique_ptr<::mlspp::State>&& state) return changeMap; } -bool session::HasCryptographicStateForWelcome() const noexcept +bool session::has_cryptographic_state_for_welcome() const noexcept { return joinKeyPackage_ && joinInitPrivateKey_ && selfSigPrivateKey_ && selfHPKEPrivateKey_; } -bool session::VerifyWelcomeState(::mlspp::State const& state, - std::set const& recognizedUserIDs) const +bool session::verify_welcome_state(::mlspp::State const& state, + std::set const& recognizedUserIDs) const { if (!externalSender_) { DISCORD_LOG(LS_ERROR) << "Cannot verify MLS welcome without an external sender"; @@ -545,7 +545,7 @@ bool session::VerifyWelcomeState(::mlspp::State const& state, // before all in-flight proposals were handled. for (const auto& leaf : state.roster()) { - if (!IsRecognizedUserID(leaf.credential, recognizedUserIDs)) { + if (!is_recognized_user_id(leaf.credential, recognizedUserIDs)) { DISCORD_LOG(LS_ERROR) << "MLS welcome lists unrecognized user ID"; // TRACK_MLS_ERROR("Welcome message lists unrecognized user ID"); // return false; @@ -555,8 +555,8 @@ bool session::VerifyWelcomeState(::mlspp::State const& state, return true; } -void session::InitLeafNode(std::string const& selfUserId, - std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept +void session::init_leaf_node(std::string const& selfUserId, + std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept try { auto ciphersuite = ciphersuite_for_protocol_version(protocolVersion_); @@ -599,7 +599,7 @@ catch (const std::exception& e) { TRACK_MLS_ERROR(e.what()); } -void session::ResetJoinKeyPackage() noexcept +void session::reset_join_key_package() noexcept try { if (!selfLeafNode_) { DISCORD_LOG(LS_ERROR) << "Cannot initialize join key package without a leaf node"; @@ -626,7 +626,7 @@ catch (const std::exception& e) { TRACK_MLS_ERROR(e.what()); } -void session::CreatePendingGroup() noexcept +void session::create_pending_group() noexcept try { if (groupId_.empty()) { DISCORD_LOG(LS_ERROR) << "Cannot create MLS group without a group ID"; @@ -663,11 +663,11 @@ catch (const std::exception& e) { return; } -std::vector session::GetMarshalledKeyPackage() noexcept +std::vector session::get_marshalled_key_package() noexcept try { // key packages are not meant to be re-used // so every time the client asks for a key package we create a new one - ResetJoinKeyPackage(); + reset_join_key_package(); if (!joinKeyPackage_) { DISCORD_LOG(LS_ERROR) << "Cannot marshal an uninitialized key package"; @@ -682,7 +682,7 @@ catch (const std::exception& e) { return {}; } -std::unique_ptr session::GetKeyRatchet(std::string const& userId) const noexcept +std::unique_ptr session::get_key_ratchet(std::string const& userId) const noexcept { if (!currentState_) { DISCORD_LOG(LS_ERROR) << "Cannot get key ratchet without an established MLS group"; @@ -703,9 +703,9 @@ std::unique_ptr session::GetKeyRatchet(std::string const& return std::make_unique(currentState_->cipher_suite(), std::move(baseSecret)); } -void session::GetPairwiseFingerprint(uint16_t version, - std::string const& userId, - PairwiseFingerprintCallback callback) const noexcept +void session::get_pairwise_fingerprint(uint16_t version, + std::string const& userId, + pairwise_fingerprint_callback callback) const noexcept try { if (!currentState_ || !selfSigPrivateKey_) { throw std::invalid_argument("No established MLS group"); @@ -787,7 +787,7 @@ catch (const std::exception& e) { callback({}); } -void session::ClearPendingState() +void session::clear_pending_state() { pendingGroupState_.reset(); pendingGroupCommit_.reset(); diff --git a/src/dpp/dave/session.h b/src/dpp/dave/session.h index 90c7eb2199..7dce12c243 100755 --- a/src/dpp/dave/session.h +++ b/src/dpp/dave/session.h @@ -63,61 +63,61 @@ class session { ~session() noexcept; - void Init(protocol_version version, + void init(protocol_version version, uint64_t groupId, std::string const& selfUserId, std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept; - void Reset() noexcept; + void reset() noexcept; - void SetProtocolVersion(protocol_version version) noexcept; - protocol_version GetProtocolVersion() const noexcept { return protocolVersion_; } + void set_protocol_version(protocol_version version) noexcept; + [[nodiscard]] protocol_version get_protocol_version() const noexcept { return protocolVersion_; } - std::vector GetLastEpochAuthenticator() const noexcept; + [[nodiscard]] std::vector get_last_epoch_authenticator() const noexcept; - void SetExternalSender(std::vector const& externalSenderPackage) noexcept; + void set_external_sender(std::vector const& externalSenderPackage) noexcept; - std::optional> ProcessProposals( + std::optional> process_proposals( std::vector proposals, std::set const& recognizedUserIDs) noexcept; - roster_variant ProcessCommit(std::vector commit) noexcept; + roster_variant process_commit(std::vector commit) noexcept; - std::optional ProcessWelcome( + std::optional process_welcome( std::vector welcome, std::set const& recognizedUserIDs) noexcept; - std::vector GetMarshalledKeyPackage() noexcept; + std::vector get_marshalled_key_package() noexcept; - std::unique_ptr GetKeyRatchet(std::string const& userId) const noexcept; + [[nodiscard]] std::unique_ptr get_key_ratchet(std::string const& userId) const noexcept; - using PairwiseFingerprintCallback = std::function const&)>; + using pairwise_fingerprint_callback = std::function const&)>; - void GetPairwiseFingerprint(uint16_t version, - std::string const& userId, - PairwiseFingerprintCallback callback) const noexcept; + void get_pairwise_fingerprint(uint16_t version, + std::string const& userId, + pairwise_fingerprint_callback callback) const noexcept; private: - void InitLeafNode(std::string const& selfUserId, - std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept; - void ResetJoinKeyPackage() noexcept; + void init_leaf_node(std::string const& selfUserId, + std::shared_ptr<::mlspp::SignaturePrivateKey>& transientKey) noexcept; + void reset_join_key_package() noexcept; - void CreatePendingGroup() noexcept; + void create_pending_group() noexcept; - bool HasCryptographicStateForWelcome() const noexcept; + bool has_cryptographic_state_for_welcome() const noexcept; - bool IsRecognizedUserID(const ::mlspp::Credential& cred, - std::set const& recognizedUserIDs) const; - bool ValidateProposalMessage(::mlspp::AuthenticatedContent const& message, - ::mlspp::State const& targetState, - std::set const& recognizedUserIDs) const; - bool VerifyWelcomeState(::mlspp::State const& state, - std::set const& recognizedUserIDs) const; + bool is_recognized_user_id(const ::mlspp::Credential& cred, + std::set const& recognizedUserIDs) const; + bool validate_proposal_message(::mlspp::AuthenticatedContent const& message, + ::mlspp::State const& targetState, + std::set const& recognizedUserIDs) const; + bool verify_welcome_state(::mlspp::State const& state, + std::set const& recognizedUserIDs) const; - bool CanProcessCommit(const ::mlspp::MLSMessage& commit) noexcept; + bool can_process_commit(const ::mlspp::MLSMessage& commit) noexcept; - roster_map ReplaceState(std::unique_ptr<::mlspp::State>&& state); + roster_map replace_state(std::unique_ptr<::mlspp::State>&& state); - void ClearPendingState(); + void clear_pending_state(); inline static const std::string USER_MEDIA_KEY_BASE_LABEL = "Discord Secure Frames v0"; diff --git a/src/dpp/discordvoiceclient.cpp b/src/dpp/discordvoiceclient.cpp index 04fd21e3b3..046c8c784c 100644 --- a/src/dpp/discordvoiceclient.cpp +++ b/src/dpp/discordvoiceclient.cpp @@ -114,8 +114,8 @@ void discord_voice_client::get_user_privacy_code(const dpp::snowflake user, priv callback(""); return; } - mls_state->dave_session->GetPairwiseFingerprint(0x0000, user.str(), [callback](const std::vector& data) { - std::cout << dpp::utility::debug_dump((uint8_t*)data.data(), data.size()); + mls_state->dave_session->get_pairwise_fingerprint(0x0000, user.str(), [callback](const std::vector &data) { + std::cout << dpp::utility::debug_dump((uint8_t *) data.data(), data.size()); callback(data.size() == 64 ? generate_displayable_code(data, 45) : ""); }); #else diff --git a/src/dpp/voice/enabled/handle_frame.cpp b/src/dpp/voice/enabled/handle_frame.cpp index 2237088df1..a0683ece2e 100644 --- a/src/dpp/voice/enabled/handle_frame.cpp +++ b/src/dpp/voice/enabled/handle_frame.cpp @@ -45,7 +45,7 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod case voice_client_dave_mls_external_sender: { log(ll_debug, "voice_client_dave_mls_external_sender"); - mls_state->dave_session->SetExternalSender(dave_header->get_data(data.length())); + mls_state->dave_session->set_external_sender(dave_header->get_data(data.length())); mls_state->encryptor = std::make_unique(); mls_state->decryptors.clear(); @@ -54,7 +54,7 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod case voice_client_dave_mls_proposals: { log(ll_debug, "voice_client_dave_mls_proposals"); - std::optional> response = mls_state->dave_session->ProcessProposals(dave_header->get_data(data.length()), dave_mls_user_list); + std::optional> response = mls_state->dave_session->process_proposals(dave_header->get_data(data.length()), dave_mls_user_list); if (response.has_value()) { auto r = response.value(); mls_state->cached_commit = r; @@ -65,14 +65,14 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod break; case voice_client_dave_announce_commit_transaction: { log(ll_debug, "voice_client_dave_announce_commit_transaction"); - auto r = mls_state->dave_session->ProcessCommit(mls_state->cached_commit); + auto r = mls_state->dave_session->process_commit(mls_state->cached_commit); for (const auto& user : dave_mls_user_list) { - log(ll_debug, "Setting decryptor key ratchet for user: " + user + ", protocol version: " + std::to_string(mls_state->dave_session->GetProtocolVersion())); + log(ll_debug, "Setting decryptor key ratchet for user: " + user + ", protocol version: " + std::to_string(mls_state->dave_session->get_protocol_version())); dpp::snowflake u{user}; mls_state->decryptors.emplace(u, std::make_unique()); - mls_state->decryptors.find(u)->second->transition_to_key_ratchet(mls_state->dave_session->GetKeyRatchet(user)); + mls_state->decryptors.find(u)->second->transition_to_key_ratchet(mls_state->dave_session->get_key_ratchet(user)); } - mls_state->encryptor->set_key_ratchet(mls_state->dave_session->GetKeyRatchet(creator->me.id.str())); + mls_state->encryptor->set_key_ratchet(mls_state->dave_session->get_key_ratchet(creator->me.id.str())); /** * https://www.ietf.org/archive/id/draft-ietf-mls-protocol-14.html#name-epoch-authenticators @@ -80,7 +80,7 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod * The main MLS key schedule provides a per-epoch epoch_authenticator. If one member of the group is being impersonated by an active attacker, * the epoch_authenticator computed by their client will differ from those computed by the other group members. */ - mls_state->privacy_code = generate_displayable_code(mls_state->dave_session->GetLastEpochAuthenticator()); + mls_state->privacy_code = generate_displayable_code(mls_state->dave_session->get_last_epoch_authenticator()); log(ll_debug, "E2EE Privacy Code: " + mls_state->privacy_code); if (!creator->on_voice_ready.empty()) { @@ -94,17 +94,17 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod case voice_client_dave_mls_welcome: { this->mls_state->transition_id = dave_header->get_welcome_transition_id(); log(ll_debug, "voice_client_dave_mls_welcome with transition id " + std::to_string(this->mls_state->transition_id)); - auto r = mls_state->dave_session->ProcessWelcome(dave_header->get_welcome_data(data.length()), dave_mls_user_list); + auto r = mls_state->dave_session->process_welcome(dave_header->get_welcome_data(data.length()), dave_mls_user_list); if (r.has_value()) { for (const auto& user : dave_mls_user_list) { - log(ll_debug, "Setting decryptor key ratchet for user: " + user + ", protocol version: " + std::to_string(mls_state->dave_session->GetProtocolVersion())); + log(ll_debug, "Setting decryptor key ratchet for user: " + user + ", protocol version: " + std::to_string(mls_state->dave_session->get_protocol_version())); dpp::snowflake u{user}; mls_state->decryptors.emplace(u, std::make_unique()); - mls_state->decryptors.find(u)->second->transition_to_key_ratchet(mls_state->dave_session->GetKeyRatchet(user)); + mls_state->decryptors.find(u)->second->transition_to_key_ratchet(mls_state->dave_session->get_key_ratchet(user)); } - mls_state->encryptor->set_key_ratchet(mls_state->dave_session->GetKeyRatchet(creator->me.id.str())); + mls_state->encryptor->set_key_ratchet(mls_state->dave_session->get_key_ratchet(creator->me.id.str())); } - mls_state->privacy_code = generate_displayable_code(mls_state->dave_session->GetLastEpochAuthenticator()); + mls_state->privacy_code = generate_displayable_code(mls_state->dave_session->get_last_epoch_authenticator()); log(ll_debug, "E2EE Privacy Code: " + mls_state->privacy_code); if (!creator->on_voice_ready.empty()) { @@ -200,8 +200,8 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod uint64_t epoch = j["d"]["epoch"]; log(ll_debug, "voice_client_dave_prepare_epoch version=" + std::to_string(protocol_version) + " for epoch " + std::to_string(epoch)); if (epoch == 1) { - mls_state->dave_session->Reset(); - mls_state->dave_session->Init(dave::max_protocol_version(), channel_id, creator->me.id.str(), mls_state->mls_key); + mls_state->dave_session->reset(); + mls_state->dave_session->init(dave::max_protocol_version(), channel_id, creator->me.id.str(), mls_state->mls_key); } } break; @@ -321,8 +321,8 @@ bool discord_voice_client::handle_frame(const std::string &data, ws_opcode opcod nullptr, "" /* sessionid */, [this](std::string const& s1, std::string const& s2) { log(ll_debug, "Dave session constructor callback: " + s1 + ", " + s2); }); - mls_state->dave_session->Init(dave::max_protocol_version(), channel_id, creator->me.id.str(), mls_state->mls_key); - auto key_response = mls_state->dave_session->GetMarshalledKeyPackage(); + mls_state->dave_session->init(dave::max_protocol_version(), channel_id, creator->me.id.str(), mls_state->mls_key); + auto key_response = mls_state->dave_session->get_marshalled_key_package(); key_response.insert(key_response.begin(), voice_client_dave_mls_key_package); this->write(std::string_view(reinterpret_cast(key_response.data()), key_response.size()), OP_BINARY);