29enum class EncryptionType {
36inline constexpr const char *kDefaultRatchetSalt =
"LKFrameEncryptionKey";
37inline constexpr int kDefaultRatchetWindowSize = 16;
38inline constexpr int kDefaultFailureTolerance = -1;
63 std::vector<std::uint8_t>
ratchet_salt = std::vector<std::uint8_t>(
64 kDefaultRatchetSalt, kDefaultRatchetSalt + std::char_traits<char>::length(
65 kDefaultRatchetSalt));
89 EncryptionType encryption_type = EncryptionType::GCM;
130 void setSharedKey(
const std::vector<std::uint8_t> &key,
int key_index = 0);
139 void setKey(
const std::string &participant_identity,
140 const std::vector<std::uint8_t> &key,
int key_index = 0);
143 std::vector<std::uint8_t>
exportKey(
const std::string &participant_identity,
144 int key_index = 0)
const;
147 std::vector<std::uint8_t>
148 ratchetKey(
const std::string &participant_identity,
int key_index = 0);
154 std::uint64_t room_handle_{0};
160 FrameCryptor(std::uint64_t room_handle, std::string participant_identity,
161 int key_index,
bool enabled);
168 const std::string &participantIdentity()
const;
169 int keyIndex()
const;
170 bool enabled()
const;
179 std::uint64_t room_handle_{0};
180 bool enabled_{
false};
181 std::string participant_identity_;
185 ~E2EEManager() =
default;
186 E2EEManager(
const E2EEManager &) =
delete;
187 E2EEManager &operator=(
const E2EEManager &) =
delete;
188 E2EEManager(E2EEManager &&) noexcept = delete;
189 E2EEManager &operator=(E2EEManager &&) noexcept = delete;
215 std::uint64_t room_handle_{0};
216 bool enabled_{
false};
217 E2EEOptions options_;
218 KeyProvider key_provider_;
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.
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.
bool enabled() const
Returns whether E2EE is currently enabled for this room at runtime.
std::vector< E2EEManager::FrameCryptor > frameCryptors() const
Retrieves the current list of frame cryptors from the underlying runtime.
void setEnabled(bool enabled)
KeyProvider * keyProvider()
std::optional< std::vector< std::uint8_t > > shared_key
Definition e2ee.h:58
std::vector< std::uint8_t > ratchet_salt
Definition e2ee.h:63
int ratchet_window_size
Controls how many previous keys are retained during ratcheting.
Definition e2ee.h:68
int failure_tolerance
Number of tolerated ratchet failures before reporting encryption errors.
Definition e2ee.h:71