25#include "livekit/visibility.h"
45inline constexpr int kDefaultRatchetWindowSize = 16;
46inline constexpr int kDefaultFailureTolerance = -1;
47inline constexpr int kDefaultKeyRingSize = 16;
70 std::vector<std::uint8_t>
ratchet_salt = std::vector<std::uint8_t>(
139 void setSharedKey(
const std::vector<std::uint8_t>& key,
int key_index = 0);
148 void setKey(
const std::string& participant_identity,
const std::vector<std::uint8_t>& key,
int key_index = 0);
151 std::vector<std::uint8_t>
exportKey(
const std::string& participant_identity,
int key_index = 0)
const;
154 std::vector<std::uint8_t>
ratchetKey(
const std::string& participant_identity,
int key_index = 0);
159 std::uint64_t room_handle_{0};
166 FrameCryptor(std::uint64_t room_handle, std::string participant_identity,
int key_index,
bool enabled);
173 const std::string& participantIdentity()
const;
174 int keyIndex()
const;
175 bool enabled()
const;
184 std::uint64_t room_handle_{0};
185 bool enabled_{
false};
186 std::string participant_identity_;
190 ~E2EEManager() =
default;
191 E2EEManager(
const E2EEManager&) =
delete;
192 E2EEManager& operator=(
const E2EEManager&) =
delete;
193 E2EEManager(E2EEManager&&) noexcept = delete;
194 E2EEManager& operator=(E2EEManager&&) noexcept = delete;
197 bool enabled() const;
204 void setEnabled(
bool enabled);
216 std::weak_ptr<const
KeyProvider> keyProvider() const;
227 std::uint64_t room_handle_{0};
228 bool enabled_{
false};
229 E2EEOptions options_;
232 std::shared_ptr<KeyProvider> key_provider_;
Frame-level cryptor controls for one participant.
Definition e2ee.h:164
void setKeyIndex(int key_index)
Sets the active key index for this participant cryptor.
void setEnabled(bool enabled)
Enables or disables frame encryption/decryption for this participant.
Manages encryption keys used by the E2EE pipeline.
Definition e2ee.h:126
std::vector< std::uint8_t > exportSharedKey(int key_index=0) const
Exports the shared key for a given key slot.
void setKey(const std::string &participant_identity, const std::vector< std::uint8_t > &key, int key_index=0)
Sets a key for a specific participant identity.
void setSharedKey(const std::vector< std::uint8_t > &key, int key_index=0)
Sets the shared key for the given key slot.
const KeyProviderOptions & options() const
Returns the options used to initialize this KeyProvider.
std::vector< std::uint8_t > exportKey(const std::string &participant_identity, int key_index=0) const
Exports a participant-specific key.
std::vector< std::uint8_t > ratchetSharedKey(int key_index=0)
Ratchets the shared key at key_index and returns the newly derived key.
std::vector< std::uint8_t > ratchetKey(const std::string &participant_identity, int key_index=0)
Ratchets a participant-specific key and returns the new key.
E2EE manager for a connected room.
Definition e2ee.h:117
Represents a LiveKit room session.
Definition room.h:98
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
constexpr const char * kDefaultRatchetSalt
Defaults (match Rust KeyProviderOptions::default()).
Definition e2ee.h:44
KeyDerivationFunction
Key derivation algorithm used by the key provider.
Definition e2ee.h:38
EncryptionType
Encryption algorithm type used by the underlying stack.
Definition e2ee.h:31
End-to-end encryption (E2EE) configuration for a room.
Definition e2ee.h:97
Options for configuring the key provider used by E2EE.
Definition e2ee.h:57
std::optional< std::vector< std::uint8_t > > shared_key
Shared static key for "shared-key E2EE" (optional).
Definition e2ee.h:65
std::vector< std::uint8_t > ratchet_salt
Salt used when deriving ratcheted keys.
Definition e2ee.h:70
int key_ring_size
Number of key slots retained by the key provider.
Definition e2ee.h:80
KeyDerivationFunction key_derivation_function
Algorithm used when deriving ratcheted keys.
Definition e2ee.h:83
int ratchet_window_size
Controls how many previous keys are retained during ratcheting.
Definition e2ee.h:74
int failure_tolerance
Number of tolerated ratchet failures before reporting encryption errors.
Definition e2ee.h:77