Skip to content

Commit

Permalink
feat: hide _makeNewSenderKey and expose a new preShareKey function
Browse files Browse the repository at this point in the history
also bumps version
  • Loading branch information
td-famedly committed May 22, 2024
1 parent 69c12b1 commit 48043ec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.29.6] 22nd May 2024
- feat: hide _makeNewSenderKey and expose a new preShareKey function (td)

## [0.29.5] 22nd May 2024
- feat: make voip key generator public (td)

Expand Down
15 changes: 10 additions & 5 deletions lib/src/voip/backend/livekit_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ class LiveKitBackend extends CallBackend {
return newIndex;
}

Future<void> preShareKey(GroupCallSession groupCall) async {
await groupCall.onMemberStateChanged();
await _makeNewSenderKey(groupCall, false);
}

/// makes a new e2ee key for local user and sets it with a delay if specified
/// used on first join and when someone leaves
///
/// also does the sending for you
Future<void> makeNewSenderKey(
Future<void> _makeNewSenderKey(
GroupCallSession groupCall, bool delayBeforeUsingKeyOurself) async {
final key = secureRandomBytes(32);
final keyIndex = _getNewEncryptionKeyIndex();
Expand Down Expand Up @@ -87,7 +92,7 @@ class LiveKitBackend extends CallBackend {
final myKeys = _encryptionKeysMap[groupCall.localParticipant];

if (myKeys == null || myKeys.isEmpty) {
await makeNewSenderKey(groupCall, false);
await _makeNewSenderKey(groupCall, false);
return;
}

Expand Down Expand Up @@ -186,7 +191,7 @@ class LiveKitBackend extends CallBackend {
if (myKeys == null || myLatestKey == null) {
Logs().w(
'[VOIP E2EE] _sendEncryptionKeysEvent Tried to send encryption keys event but no keys found!');
await makeNewSenderKey(groupCall, false);
await _makeNewSenderKey(groupCall, false);
await _sendEncryptionKeysEvent(
groupCall,
keyIndex,
Expand Down Expand Up @@ -392,7 +397,7 @@ class LiveKitBackend extends CallBackend {
if (groupCall.voip.enableSFUE2EEKeyRatcheting) {
await _ratchetLocalParticipantKey(groupCall, anyJoined);
} else {
await makeNewSenderKey(groupCall, true);
await _makeNewSenderKey(groupCall, true);
}
}

Expand All @@ -409,7 +414,7 @@ class LiveKitBackend extends CallBackend {
}
_memberLeaveEncKeyRotateDebounceTimer =
Timer(CallTimeouts.makeKeyDelay, () async {
await makeNewSenderKey(groupCall, true);
await _makeNewSenderKey(groupCall, true);
});
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: matrix
description: Matrix Dart SDK
version: 0.29.5
version: 0.29.6
homepage: https://famedly.com
repository: https://github.com/famedly/matrix-dart-sdk.git
issue_tracker: https://github.com/famedly/matrix-dart-sdk/issues
Expand Down

0 comments on commit 48043ec

Please sign in to comment.