@signalapp/ringrtc 2.42.0 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -669,7 +669,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
669
669
 
670
670
  ```
671
671
 
672
- ## libsignal-core 0.1.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.42.0
672
+ ## libsignal-core 0.1.0, mrp 2.44.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.44.0
673
673
 
674
674
  ```
675
675
  GNU AFFERO GENERAL PUBLIC LICENSE
@@ -96,7 +96,7 @@ export declare class RingRTCType {
96
96
  handleOutgoingSignaling: ((remoteUserId: UserId, message: CallingMessage) => Promise<boolean>) | null;
97
97
  handleIncomingCall: ((call: Call) => Promise<boolean>) | null;
98
98
  handleStartCall: ((call: Call) => Promise<boolean>) | null;
99
- handleAutoEndedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallEndedReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined) => void) | null;
99
+ handleAutoEndedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallEndedReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined, receivedAtDate: number | undefined) => void) | null;
100
100
  handleLogMessage: ((level: CallLogLevel, fileName: string, line: number, message: string) => void) | null;
101
101
  handleSendHttpRequest: ((requestId: number, url: string, method: HttpMethod, headers: {
102
102
  [name: string]: string;
@@ -249,7 +249,17 @@ export declare class RingRTCType {
249
249
  logError(message: string): void;
250
250
  logWarn(message: string): void;
251
251
  logInfo(message: string): void;
252
- handleCallingMessage(remoteUserId: UserId, remoteUuid: Buffer | null, remoteDeviceId: DeviceId, localDeviceId: DeviceId, messageAgeSec: number, messageReceivedAtCounter: number, message: CallingMessage, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
252
+ handleCallingMessage(message: CallingMessage, options: {
253
+ remoteUserId: UserId;
254
+ remoteUuid?: Buffer;
255
+ remoteDeviceId: DeviceId;
256
+ localDeviceId: DeviceId;
257
+ ageSec: number;
258
+ receivedAtCounter: number;
259
+ receivedAtDate: number;
260
+ senderIdentityKey: Buffer;
261
+ receiverIdentityKey: Buffer;
262
+ }): void;
253
263
  sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: {
254
264
  [name: string]: string;
255
265
  }, body: Buffer | undefined): void;
@@ -238,9 +238,10 @@ class Requests {
238
238
  }
239
239
  }
240
240
  class CallInfo {
241
- constructor(isVideoCall, receivedAtCounter) {
241
+ constructor(isVideoCall, receivedAtCounter, receivedAtDate) {
242
242
  this.isVideoCall = isVideoCall;
243
243
  this.receivedAtCounter = receivedAtCounter;
244
+ this.receivedAtDate = receivedAtDate;
244
245
  }
245
246
  }
246
247
  class RingRTCType {
@@ -388,9 +389,10 @@ class RingRTCType {
388
389
  // Called by Rust
389
390
  onCallEnded(remoteUserId, callId, reason, ageSec) {
390
391
  const callInfo = this._callInfoByCallId.get(this.getCallInfoKey(callId));
391
- const { isVideoCall, receivedAtCounter } = callInfo || {
392
+ const { isVideoCall, receivedAtCounter, receivedAtDate } = callInfo || {
392
393
  isVideoCall: false,
393
394
  receivedAtCounter: undefined,
395
+ receivedAtDate: undefined,
394
396
  };
395
397
  this._callInfoByCallId.delete(this.getCallInfoKey(callId));
396
398
  const call = this._call;
@@ -419,7 +421,7 @@ class RingRTCType {
419
421
  reason === CallEndedReason.ReceivedOfferExpired ||
420
422
  (call.state === CallState.Prering && call.isIncoming)) {
421
423
  if (this.handleAutoEndedIncomingCallRequest) {
422
- this.handleAutoEndedIncomingCallRequest(callId, remoteUserId, reason, ageSec, isVideoCall, receivedAtCounter);
424
+ this.handleAutoEndedIncomingCallRequest(callId, remoteUserId, reason, ageSec, isVideoCall, receivedAtCounter, receivedAtDate);
423
425
  }
424
426
  if (call && call.state === CallState.Prering && call.isIncoming) {
425
427
  // Set the state to Ended without triggering a state update since we
@@ -960,9 +962,9 @@ class RingRTCType {
960
962
  this.onLogMessage(CallLogLevel.Info, 'Service.ts', 0, message);
961
963
  }
962
964
  // Called by MessageReceiver
963
- handleCallingMessage(remoteUserId, remoteUuid, remoteDeviceId, localDeviceId, messageAgeSec, messageReceivedAtCounter, message, senderIdentityKey, receiverIdentityKey) {
965
+ handleCallingMessage(message, options) {
964
966
  if (message.destinationDeviceId &&
965
- message.destinationDeviceId !== localDeviceId) {
967
+ message.destinationDeviceId !== options.localDeviceId) {
966
968
  // Drop the message as it isn't for this device, handleIgnoredCall() is not needed.
967
969
  return;
968
970
  }
@@ -977,9 +979,9 @@ class RingRTCType {
977
979
  }
978
980
  const offerType = message.offer.type || OfferType.AudioCall;
979
981
  // Save the call details for later when the call is ended.
980
- const callInfo = new CallInfo(offerType === OfferType.VideoCall, messageReceivedAtCounter);
982
+ const callInfo = new CallInfo(offerType === OfferType.VideoCall, options.receivedAtCounter, options.receivedAtDate);
981
983
  this._callInfoByCallId.set(this.getCallInfoKey(callId), callInfo);
982
- this.callManager.receivedOffer(remoteUserId, remoteDeviceId, localDeviceId, messageAgeSec, callId, offerType, opaque, senderIdentityKey, receiverIdentityKey);
984
+ this.callManager.receivedOffer(options.remoteUserId, options.remoteDeviceId, options.localDeviceId, options.ageSec, callId, offerType, opaque, options.senderIdentityKey, options.receiverIdentityKey);
983
985
  }
984
986
  if (message.answer?.callId) {
985
987
  const callId = message.answer.callId;
@@ -990,7 +992,7 @@ class RingRTCType {
990
992
  this.logError('handleCallingMessage(): opaque not received for answer, remote should update');
991
993
  return;
992
994
  }
993
- this.callManager.receivedAnswer(remoteUserId, remoteDeviceId, callId, opaque, senderIdentityKey, receiverIdentityKey);
995
+ this.callManager.receivedAnswer(options.remoteUserId, options.remoteDeviceId, callId, opaque, options.senderIdentityKey, options.receiverIdentityKey);
994
996
  }
995
997
  if (message.iceCandidates && message.iceCandidates.length > 0) {
996
998
  // We assume they all have the same .callId
@@ -1016,20 +1018,20 @@ class RingRTCType {
1016
1018
  this.logWarn('handleCallingMessage(): No call ID in ice message');
1017
1019
  return;
1018
1020
  }
1019
- this.callManager.receivedIceCandidates(remoteUserId, remoteDeviceId, callId, candidates);
1021
+ this.callManager.receivedIceCandidates(options.remoteUserId, options.remoteDeviceId, callId, candidates);
1020
1022
  }
1021
1023
  if (message.hangup?.callId) {
1022
1024
  const callId = message.hangup.callId;
1023
1025
  const hangupType = message.hangup.type || HangupType.Normal;
1024
1026
  const hangupDeviceId = message.hangup.deviceId || null;
1025
- this.callManager.receivedHangup(remoteUserId, remoteDeviceId, callId, hangupType, hangupDeviceId);
1027
+ this.callManager.receivedHangup(options.remoteUserId, options.remoteDeviceId, callId, hangupType, hangupDeviceId);
1026
1028
  }
1027
1029
  if (message.busy?.callId) {
1028
1030
  const callId = message.busy.callId;
1029
- this.callManager.receivedBusy(remoteUserId, remoteDeviceId, callId);
1031
+ this.callManager.receivedBusy(options.remoteUserId, options.remoteDeviceId, callId);
1030
1032
  }
1031
1033
  if (message.opaque) {
1032
- if (remoteUuid == null) {
1034
+ if (options.remoteUuid === undefined) {
1033
1035
  this.logError('handleCallingMessage(): opaque message received without UUID!');
1034
1036
  return;
1035
1037
  }
@@ -1038,7 +1040,7 @@ class RingRTCType {
1038
1040
  this.logError('handleCallingMessage(): opaque message received without data!');
1039
1041
  return;
1040
1042
  }
1041
- this.callManager.receivedCallMessage(remoteUuid, remoteDeviceId, localDeviceId, data, messageAgeSec);
1043
+ this.callManager.receivedCallMessage(options.remoteUuid, options.remoteDeviceId, options.localDeviceId, data, options.ageSec);
1042
1044
  }
1043
1045
  }
1044
1046
  // Called by Rust
@@ -42,8 +42,8 @@ export declare class GumVideoCapturer {
42
42
  constructor(defaultCaptureOptions: GumVideoCaptureOptions);
43
43
  capturing(): boolean;
44
44
  setLocalPreview(localPreview: Ref<HTMLVideoElement> | undefined): void;
45
- enableCapture(): void;
46
- enableCaptureAndSend(sender: VideoFrameSender, options?: GumVideoCaptureOptions): void;
45
+ enableCapture(): Promise<void>;
46
+ enableCaptureAndSend(sender?: VideoFrameSender, options?: GumVideoCaptureOptions): Promise<void>;
47
47
  disable(): void;
48
48
  setPreferredDevice(deviceId: string): Promise<void>;
49
49
  enumerateDevices(): Promise<Array<MediaDeviceInfo>>;
@@ -72,14 +72,16 @@ class GumVideoCapturer {
72
72
  }
73
73
  this.updateLocalPreviewIntervalId = setInterval(this.updateLocalPreviewSourceObject.bind(this), 1000);
74
74
  }
75
- enableCapture() {
76
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
77
- this.startCapturing(this.defaultCaptureOptions);
75
+ async enableCapture() {
76
+ return this.startCapturing(this.defaultCaptureOptions);
78
77
  }
79
- enableCaptureAndSend(sender, options) {
80
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
81
- this.startCapturing(options ?? this.defaultCaptureOptions);
82
- this.startSending(sender);
78
+ async enableCaptureAndSend(sender, options) {
79
+ const startCapturingPromise = this.startCapturing(options ?? this.defaultCaptureOptions);
80
+ if (sender) {
81
+ this.startSending(sender);
82
+ }
83
+ // Bubble up the error.
84
+ return startCapturingPromise;
83
85
  }
84
86
  disable() {
85
87
  this.stopCapturing();
@@ -95,11 +97,8 @@ class GumVideoCapturer {
95
97
  if (this.captureOptions) {
96
98
  const { captureOptions, sender } = this;
97
99
  this.disable();
98
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
99
- this.startCapturing(captureOptions);
100
- if (sender) {
101
- this.startSending(sender);
102
- }
100
+ // Bubble up the error if starting video failed.
101
+ return this.enableCaptureAndSend(sender, captureOptions);
103
102
  }
104
103
  }
105
104
  async enumerateDevices() {
@@ -191,6 +190,8 @@ class GumVideoCapturer {
191
190
  // We couldn't open the camera. Oh well.
192
191
  this.captureOptions = undefined;
193
192
  }
193
+ // Re-raise so that callers can surface this condition to the user.
194
+ throw e;
194
195
  }
195
196
  }
196
197
  stopCapturing() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/ringrtc",
3
- "version": "2.42.0",
3
+ "version": "2.44.0",
4
4
  "description": "Signal Messenger voice and video calling library.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "config": {
27
27
  "prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz",
28
- "prebuildChecksum": "c7ce95993ed4cc77b6b912e052deb4c8671d63e44605c12b576a5872293f687e"
28
+ "prebuildChecksum": "a717f07c4a73ea43a5bcd7009a709cc149dc280aa5f1d0cf9d651c0d5eab59a8"
29
29
  },
30
30
  "author": "",
31
31
  "license": "AGPL-3.0-only",