Remove unused property MatrixEvent.untrusted (#5118)

* Remove unused property MatrixEvent.untrusted

This was never set to anything other than `false`. I think it is a hangover
from pre-rust-sdk.

* Remove call to redundant `isKeySourceUntrusted`

`isKeySourceUntrusted` always returns false so no point calling it

* Remove dangling assignments to MatrixEvent.untrusted
This commit is contained in:
Richard van der Hoff
2026-01-06 11:23:13 +00:00
committed by GitHub
parent 4b89fb23c5
commit aeade9ce58
3 changed files with 5 additions and 20 deletions
-5
View File
@@ -213,11 +213,6 @@ export interface EventDecryptionResult {
* ed25519 key claimed by the sender of this event. See {@link MatrixEvent#getClaimedEd25519Key}.
*/
claimedEd25519Key?: string;
/**
* Whether the keys for this event have been received via an unauthenticated source (eg via key forwards, or
* restored from backup)
*/
untrusted?: boolean;
}
/**
+5 -14
View File
@@ -185,8 +185,7 @@ export interface IDecryptOptions {
isRetry?: boolean;
/**
* Whether the message should be re-decrypted if it was previously successfully decrypted with an untrusted key.
* Defaults to `false`.
* @deprecated does nothing
*/
forceRedecryptIfUntrusted?: boolean;
}
@@ -284,10 +283,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
*/
private claimedEd25519Key: string | null = null;
/* where the decryption key is untrusted
*/
private untrusted: boolean | null = null;
/* if we have a process decrypting this event, a Promise which resolves
* when it is finished. Normally null.
*/
@@ -887,8 +882,7 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
}
const alreadyDecrypted = this.clearEvent && !this.isDecryptionFailure();
const forceRedecrypt = options.forceRedecryptIfUntrusted && this.isKeySourceUntrusted();
if (alreadyDecrypted && !forceRedecrypt) {
if (alreadyDecrypted) {
// we may want to just ignore this? let's start with rejecting it.
throw new Error("Attempt to decrypt event which has already been decrypted");
}
@@ -1022,7 +1016,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
this.clearEvent = decryptionResult.clearEvent;
this.senderCurve25519Key = decryptionResult.senderCurve25519Key ?? null;
this.claimedEd25519Key = decryptionResult.claimedEd25519Key ?? null;
this.untrusted = decryptionResult.untrusted || false;
this.invalidateExtensibleEvent();
}
@@ -1041,7 +1034,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
};
this.senderCurve25519Key = null;
this.claimedEd25519Key = null;
this.untrusted = false;
this.invalidateExtensibleEvent();
}
@@ -1126,11 +1118,10 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
}
/**
* Whether the decryption key was obtained from an untrusted source. If so,
* we cannot verify the authenticity of the message.
* @deprecated always returns false
*/
public isKeySourceUntrusted(): boolean | undefined {
return !!this.untrusted;
public isKeySourceUntrusted(): false {
return false;
}
public getUnsigned(): IUnsigned {
-1
View File
@@ -180,7 +180,6 @@ export async function decryptExistingEvent(
content: opts.plainContent,
},
senderCurve25519Key: "",
untrusted: false,
};
const mockCrypto = {