Update encrypted state to say MSC4362 everywhere (#5079)

* Update encrypted state to say MSC4362 everywhere

* Fix test failure with encrypted state: handle empty string state key
This commit is contained in:
Andy Balaam
2025-12-09 12:47:38 +00:00
committed by GitHub
parent fdfddde55a
commit 582a76d87c
6 changed files with 10 additions and 8 deletions
+3 -1
View File
@@ -305,7 +305,9 @@ export function encryptMegolmEventRawPlainText(opts: {
},
type: "m.room.encrypted",
unsigned: {},
state_key: opts.plaintext.state_key ? `${opts.plaintext.type}:${opts.plaintext.state_key}` : undefined,
state_key: opts.plaintext.hasOwnProperty("state_key")
? `${opts.plaintext.type}:${opts.plaintext.state_key}`
: undefined,
};
}
+1 -1
View File
@@ -82,7 +82,7 @@ export function getSyncResponse(
state_key: "",
content: {
"algorithm": "m.megolm.v1.aes-sha2",
"io.element.msc3414.encrypt_state_events": encryptStateEvents,
"io.element.msc4362.encrypt_state_events": encryptStateEvents,
},
}),
],
+1 -1
View File
@@ -106,7 +106,7 @@ export interface RoomPinnedEventsEventContent {
export interface RoomEncryptionEventContent {
"algorithm": "m.megolm.v1.aes-sha2";
"io.element.msc3414.encrypt_state_events"?: boolean;
"io.element.msc4362.encrypt_state_events"?: boolean;
"rotation_period_ms"?: number;
"rotation_period_msgs"?: number;
}
+1 -1
View File
@@ -6933,7 +6933,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return;
}
// Check if the event is excluded under MSC3414
// Check if the event is excluded under MSC4362
if (
[
"m.room.create",
+2 -2
View File
@@ -753,7 +753,7 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
/**
* Get the event state_key if it has one. If necessary, this will perform
* string-unpacking on the state key, as per MSC3414. This will return
* string-unpacking on the state key, as per MSC4362. This will return
* <code>undefined</code> for message events.
* @returns The event's `state_key`.
*/
@@ -766,7 +766,7 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
/**
* Get the raw event state_key if it has one. This may be string-packed as per
* MSC3414 if the state event is encrypted. This will return <code>undefined
* MSC4362 if the state event is encrypted. This will return <code>undefined
* </code> for message events.
* @returns The event's `state_key`.
*/
+2 -2
View File
@@ -167,7 +167,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
/** Crypto callbacks provided by the application */
private readonly cryptoCallbacks: CryptoCallbacks,
/** Enable support for encrypted state events under MSC3414. */
/** Enable support for encrypted state events under MSC4362. */
private readonly enableEncryptedStateEvents: boolean = false,
) {
super();
@@ -1817,7 +1817,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
return;
}
if (config["io.element.msc3414.encrypt_state_events"] && this.enableEncryptedStateEvents) {
if (config["io.element.msc4362.encrypt_state_events"] && this.enableEncryptedStateEvents) {
this.logger.info("crypto Enabling state event encryption...");
settings.encryptStateEvents = true;
}