diff --git a/src/crypto/index.js b/src/crypto/index.js index d2b2bc4bf..802d4660a 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -1330,12 +1330,14 @@ Crypto.prototype.checkOwnCrossSigningTrust = async function({ const seenPubkey = newCrossSigning.getId(); const masterChanged = this._crossSigningInfo.getId() !== seenPubkey; + const masterExistsNotLocallyCached = + newCrossSigning.getId() && !crossSigningPrivateKeys.has("master"); if (masterChanged) { logger.info("Got new master public key", seenPubkey); } if ( allowPrivateKeyRequests && - (masterChanged || !crossSigningPrivateKeys.has("master")) + (masterChanged || masterExistsNotLocallyCached) ) { logger.info("Attempting to retrieve cross-signing master private key"); let signing = null; @@ -1362,6 +1364,15 @@ Crypto.prototype.checkOwnCrossSigningTrust = async function({ const selfSigningChanged = oldSelfSigningId !== newCrossSigning.getId("self_signing"); const userSigningChanged = oldUserSigningId !== newCrossSigning.getId("user_signing"); + const selfSigningExistsNotLocallyCached = ( + newCrossSigning.getId("self_signing") && + !crossSigningPrivateKeys.has("self_signing") + ); + const userSigningExistsNotLocallyCached = ( + newCrossSigning.getId("user_signing") && + !crossSigningPrivateKeys.has("user_signing") + ); + const keySignatures = {}; if (selfSigningChanged) { @@ -1369,7 +1380,7 @@ Crypto.prototype.checkOwnCrossSigningTrust = async function({ } if ( allowPrivateKeyRequests && - (selfSigningChanged || !crossSigningPrivateKeys.has("self_signing")) + (selfSigningChanged || selfSigningExistsNotLocallyCached) ) { logger.info("Attempting to retrieve cross-signing self-signing private key"); let signing = null; @@ -1394,7 +1405,7 @@ Crypto.prototype.checkOwnCrossSigningTrust = async function({ } if ( allowPrivateKeyRequests && - (userSigningChanged || !crossSigningPrivateKeys.has("user_signing")) + (userSigningChanged || userSigningExistsNotLocallyCached) ) { logger.info("Attempting to retrieve cross-signing user-signing private key"); let signing = null; diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index bb73bb858..1a270c5ca 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -367,7 +367,11 @@ export class MatrixCall extends EventEmitter { this.checkForErrorListener(); try { const screenshareConstraints = await getScreenshareContraints(selectDesktopCapturerSource); - if (!screenshareConstraints) return; + if (!screenshareConstraints) { + this.terminate(CallParty.Local, CallErrorCode.NoUserMedia, false); + return; + } + if (window.electron?.getDesktopCapturerSources) { // We are using Electron logger.debug("Getting screen stream using getUserMedia()..."); @@ -388,6 +392,7 @@ export class MatrixCall extends EventEmitter { "Failed to get screen-sharing stream: ", err, ), ); + this.terminate(CallParty.Local, CallErrorCode.NoUserMedia, false); } this.type = CallType.Video; }