Skip to content

Commit 633a5a8

Browse files
authored
Mark forwardingCurve25519KeyChain as deprecated (#5111)
The Rust SDK always populates this as an empty array, so we may as well get rid of it.
1 parent a5086a0 commit 633a5a8

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

src/common-crypto/CryptoBackend.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ export interface EventDecryptionResult {
200200
*/
201201
clearEvent: IClearEvent;
202202
/**
203-
* List of curve25519 keys involved in telling us about the senderCurve25519Key and claimedEd25519Key.
203+
* No longer used.
204204
* See {@link MatrixEvent#getForwardingCurve25519KeyChain}.
205+
* @deprecated
205206
*/
206207
forwardingCurve25519KeyChain?: string[];
207208
/**

src/models/event.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
284284
*/
285285
private claimedEd25519Key: string | null = null;
286286

287-
/* curve25519 keys of devices involved in telling us about the
288-
* senderCurve25519Key and claimedEd25519Key.
289-
* See getForwardingCurve25519KeyChain().
290-
*/
291-
private forwardingCurve25519KeyChain: string[] = [];
292-
293287
/* where the decryption key is untrusted
294288
*/
295289
private untrusted: boolean | null = null;
@@ -1028,7 +1022,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
10281022
this.clearEvent = decryptionResult.clearEvent;
10291023
this.senderCurve25519Key = decryptionResult.senderCurve25519Key ?? null;
10301024
this.claimedEd25519Key = decryptionResult.claimedEd25519Key ?? null;
1031-
this.forwardingCurve25519KeyChain = decryptionResult.forwardingCurve25519KeyChain || [];
10321025
this.untrusted = decryptionResult.untrusted || false;
10331026
this.invalidateExtensibleEvent();
10341027
}
@@ -1048,7 +1041,6 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
10481041
};
10491042
this.senderCurve25519Key = null;
10501043
this.claimedEd25519Key = null;
1051-
this.forwardingCurve25519KeyChain = [];
10521044
this.untrusted = false;
10531045
this.invalidateExtensibleEvent();
10541046
}
@@ -1119,21 +1111,18 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
11191111
}
11201112

11211113
/**
1122-
* Get the curve25519 keys of the devices which were involved in telling us
1123-
* about the claimedEd25519Key and sender curve25519 key.
1124-
*
1125-
* Normally this will be empty, but in the case of a forwarded megolm
1126-
* session, the sender keys are sent to us by another device (the forwarding
1127-
* device), which we need to trust to do this. In that case, the result will
1128-
* be a list consisting of one entry.
1114+
* Returns an empty array.
11291115
*
1130-
* If the device that sent us the key (A) got it from another device which
1131-
* it wasn't prepared to vouch for (B), the result will be [A, B]. And so on.
1116+
* Previously, this returned the chain of Curve25519 keys through which
1117+
* this session was forwarded, via `m.forwarded_room_key` events.
1118+
* However, that is not cryptographically reliable, and clients should not
1119+
* be using it.
11321120
*
1133-
* @returns base64-encoded curve25519 keys, from oldest to newest.
1121+
* @see https://github.com/matrix-org/matrix-spec/issues/1089
1122+
* @deprecated
11341123
*/
11351124
public getForwardingCurve25519KeyChain(): string[] {
1136-
return this.forwardingCurve25519KeyChain;
1125+
return [];
11371126
}
11381127

11391128
/**

src/rust-crypto/rust-crypto.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,6 @@ class EventDecryptor {
22362236
clearEvent: JSON.parse(res.event),
22372237
claimedEd25519Key: res.senderClaimedEd25519Key,
22382238
senderCurve25519Key: res.senderCurve25519Key,
2239-
forwardingCurve25519KeyChain: res.forwardingCurve25519KeyChain,
22402239
};
22412240
} catch (err) {
22422241
if (err instanceof RustSdkCryptoJs.MegolmDecryptionError) {

src/testing.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ export async function decryptExistingEvent(
179179
type: opts.plainType,
180180
content: opts.plainContent,
181181
},
182-
forwardingCurve25519KeyChain: [],
183182
senderCurve25519Key: "",
184183
untrusted: false,
185184
};

0 commit comments

Comments
 (0)