Skip to content

Commit 8ad79ef

Browse files
committed
refactor: Rename BasicEncryptionManger to RTCEncryptionManager
1 parent c1b9e0f commit 8ad79ef

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,6 @@
130130
"outputDirectory": "coverage",
131131
"outputName": "jest-sonar-report.xml",
132132
"relativePaths": true
133-
}
133+
},
134+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
134135
}

spec/unit/matrixrtc/BasicEncrytionManager.spec.ts renamed to spec/unit/matrixrtc/RTCEncrytionManager.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ limitations under the License.
1616

1717
import { type Mocked } from "jest-mock";
1818

19-
import { BasicEncryptionManager } from "../../../src/matrixrtc/BasicEncryptionManager.ts";
19+
import { RTCEncryptionManager } from "../../../src/matrixrtc/RTCEncryptionManager.ts";
2020
import { type CallMembership, type Statistics } from "../../../src/matrixrtc";
2121
import { type ToDeviceKeyTransport } from "../../../src/matrixrtc/ToDeviceKeyTransport.ts";
2222
import { KeyTransportEvents, type KeyTransportEventsHandlerMap } from "../../../src/matrixrtc/IKeyTransport.ts";
2323
import { membershipTemplate, mockCallMembership } from "./mocks.ts";
2424
import { decodeBase64, TypedEventEmitter } from "../../../src";
2525

26-
describe("BasicEncryptionManager", () => {
26+
describe("RTCEncryptionManager", () => {
2727
// The manager being tested
28-
let encryptionManager: BasicEncryptionManager;
28+
let encryptionManager: RTCEncryptionManager;
2929
let getMembershipMock: jest.Mock;
3030
let mockTransport: Mocked<ToDeviceKeyTransport>;
3131
let statistics: Statistics;
@@ -51,7 +51,7 @@ describe("BasicEncryptionManager", () => {
5151
off: jest.fn(),
5252
} as unknown as Mocked<ToDeviceKeyTransport>;
5353

54-
encryptionManager = new BasicEncryptionManager(
54+
encryptionManager = new RTCEncryptionManager(
5555
"@alice:example.org",
5656
"DEVICE01",
5757
getMembershipMock,
@@ -294,7 +294,7 @@ describe("BasicEncryptionManager", () => {
294294
off: emitter.off.bind(emitter),
295295
emit: emitter.emit.bind(emitter),
296296
} as unknown as Mocked<ToDeviceKeyTransport>;
297-
encryptionManager = new BasicEncryptionManager(
297+
encryptionManager = new RTCEncryptionManager(
298298
"@alice:example.org",
299299
"DEVICE01",
300300
getMembershipMock,

src/matrixrtc/MatrixRTCSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { logDurationSync } from "../utils.ts";
3131
import { type Statistics } from "./types.ts";
3232
import { RoomKeyTransport } from "./RoomKeyTransport.ts";
3333
import type { IMembershipManager } from "./IMembershipManager.ts";
34-
import { BasicEncryptionManager } from "./BasicEncryptionManager.ts";
34+
import { RTCEncryptionManager } from "./RTCEncryptionManager.ts";
3535
import {
3636
RoomAndToDeviceEvents,
3737
type RoomAndToDeviceEventsHandlerMap,
@@ -410,7 +410,7 @@ export class MatrixRTCSession extends TypedEventEmitter<
410410

411411
// Expose the changes so the ui can display the currently used transport.
412412
this.reEmitter.reEmit(transport, [RoomAndToDeviceEvents.EnabledTransportsChanged]);
413-
this.encryptionManager = new BasicEncryptionManager(
413+
this.encryptionManager = new RTCEncryptionManager(
414414
this.client.getUserId()!,
415415
this.client.getDeviceId()!,
416416
() => this.memberships,

src/matrixrtc/BasicEncryptionManager.ts renamed to src/matrixrtc/RTCEncryptionManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ type OutboundEncryptionSession = {
3333
};
3434

3535
/**
36-
* A simple encryption manager.
36+
* RTCEncryptionManager is used to manage the encryption keys for a call.
37+
*
38+
* It is responsible for distributing the keys to the other participants and rotating the keys if needed.
39+
*
40+
* This manager when used with to-device transport will share the existing key only to new joiners, and rotate
41+
* if there is a leaver.
42+
*
43+
* XXX In the future we want to distribute a ratcheted key not the current one for new joiners.
3744
*/
38-
export class BasicEncryptionManager implements IEncryptionManager {
45+
export class RTCEncryptionManager implements IEncryptionManager {
3946
// The current per-sender media key for this device
4047
private outboundSession: OutboundEncryptionSession | null = null;
4148

0 commit comments

Comments
 (0)