-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implement lab for encrypted state events (MSC3414/MSC4362) #30877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kaylendog
wants to merge
26
commits into
element-hq:develop
Choose a base branch
from
kaylendog:kaylendog/msc3414
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+303
−12
Open
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
8c73c33
feat: Implemenet lab for encrypted state events (MSC3414)
kaylendog 7d8f991
fix: Remove addition of optional encrypt_state_events field.
kaylendog d86bea5
fix: Only include `encrypt_state_events` if we set it to true.
kaylendog e7104b7
feat: Add `stateEncryption` flag to `SecurityRoomSettingsTab`.
kaylendog 03d43ce
tests: Fixup tests for state event encryption lab.
kaylendog 8a08134
fix: Run `yarn i18n` to (hopefully) correct translations.
kaylendog d51ba4b
Merge branch 'element-hq:develop' into kaylendog/msc3414
kaylendog d053a20
Merge branch 'develop' into kaylendog/msc3414
kaylendog f568949
feat: Enable encrypted state events JS client flag by default.
kaylendog a2ff003
Merge branch 'develop' into kaylendog/msc3414
kaylendog 7a9d462
tests: Add `createRoom` tests for encryption and state event encryption.
kaylendog 6b3f273
tests: Add test for state-encrypted EncryptionEvent.
kaylendog df86a11
feat: Encrypt room name in `createRoom` if state encryption enabled.
kaylendog d7092fb
Merge branch 'develop' into kaylendog/msc3414
kaylendog da30063
fix: Erase correct options variable.
kaylendog b691621
fix: Clone createOpts rather than construct reference.
kaylendog ebd42c1
tests: Ensure room name is not included in `initial_state`.
kaylendog bed2888
fix: De-async `onChange` method in encrypted state settings controller.
kaylendog fe4c48f
Merge branch 'develop' into kaylendog/msc3414
kaylendog d11cb24
feat: Re-introduce wait on room encryption state.
kaylendog 0808466
fix: Linting error on import.
kaylendog 0fc92d4
fix: Set shared history properly, spelling issues in translations.
kaylendog bb874c4
chore: Remove redundant if statement.
kaylendog d538135
fix: Simplify E2EE state dialog caption logic.
kaylendog 10f34e1
feat: Refactor state encryption logic to helper function.
kaylendog 330ec69
Merge remote-tracking branch 'upstream/develop' into kaylendog/msc3414
kaylendog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import { | |
Visibility, | ||
} from "matrix-js-sdk/src/matrix"; | ||
import { logger } from "matrix-js-sdk/src/logger"; | ||
import { type RoomEncryptionEventContent } from "matrix-js-sdk/src/types"; | ||
|
||
import Modal, { type IHandle } from "./Modal"; | ||
import { _t, UserFriendlyError } from "./languageHandler"; | ||
|
@@ -53,6 +54,7 @@ export interface IOpts { | |
spinner?: boolean; | ||
guestAccess?: boolean; | ||
encryption?: boolean; | ||
stateEncryption?: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new public field needs doc-comment, please |
||
inlineErrors?: boolean; | ||
andView?: boolean; | ||
avatar?: File | string; // will upload if given file, else mxcUrl is needed | ||
|
@@ -100,6 +102,7 @@ export default async function createRoom(client: MatrixClient, opts: IOpts): Pro | |
if (opts.spinner === undefined) opts.spinner = true; | ||
if (opts.guestAccess === undefined) opts.guestAccess = true; | ||
if (opts.encryption === undefined) opts.encryption = false; | ||
if (opts.stateEncryption === undefined) opts.stateEncryption = false; | ||
|
||
if (client.isGuest()) { | ||
dis.dispatch({ action: "require_registration" }); | ||
|
@@ -209,12 +212,16 @@ export default async function createRoom(client: MatrixClient, opts: IOpts): Pro | |
} | ||
|
||
if (opts.encryption) { | ||
const content: RoomEncryptionEventContent = { | ||
algorithm: MEGOLM_ENCRYPTION_ALGORITHM, | ||
}; | ||
if (opts.stateEncryption) { | ||
content["io.element.msc3414.encrypt_state_events"] = true; | ||
} | ||
createOpts.initial_state.push({ | ||
type: "m.room.encryption", | ||
state_key: "", | ||
content: { | ||
algorithm: MEGOLM_ENCRYPTION_ALGORITHM, | ||
}, | ||
content, | ||
}); | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/settings/controllers/EncryptedStateEventsController.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
Copyright 2024 New Vector Ltd. | ||
|
||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import PlatformPeg from "../../PlatformPeg"; | ||
import { SettingLevel } from "../SettingLevel"; | ||
import SettingsStore from "../SettingsStore"; | ||
import SettingController from "./SettingController"; | ||
|
||
export default class EncryptedStateEventsController extends SettingController { | ||
public async onChange(): Promise<void> { | ||
SettingsStore.setValue("feature_share_history_on_invite", null, SettingLevel.CONFIG, true); | ||
kaylendog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
PlatformPeg.get()?.reload(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.