Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Replace SecurityCustomisations with CryptoSetupExtension #12342

Merged
merged 41 commits into from
Apr 12, 2024
Merged
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
328d301
Changed call sites from customisations/security to ModuleRunner.exten…
thoraj Feb 13, 2024
9b25236
Updated depenndecy and added tests
thoraj Mar 14, 2024
b84fe86
Fixed style and formatting with prettier
thoraj Mar 14, 2024
2bad8f1
Merge branch 'matrix-org:develop' into taj/cryptosetup
thoraj Mar 15, 2024
d3bbb4a
Fix according to Element PR comments
thoraj Apr 5, 2024
43aea4e
Fixing issues raised in PR review
thoraj Apr 5, 2024
78c7ea7
Removed commented code. Improved encapsulation. Removed noisy logging
thoraj Apr 6, 2024
c39c34d
Improved language of comment about calling the factory
thoraj Apr 6, 2024
b64f50c
Refactor to get better encapsulation
thoraj Apr 6, 2024
f7a2ec8
Find a better name. Provide explicit reset function. Provide more TSDoc
thoraj Apr 6, 2024
c905af8
Simplify mock for cryptoSetup, and add assertion for exception message.
thoraj Apr 7, 2024
6b79258
Merge branch 'matrix-org:develop' into taj/cryptosetup
thoraj Apr 7, 2024
158d977
Remove unused className property. Adjust TSDoc comments
thoraj Apr 7, 2024
5eccd0e
Fix linting and code style issues
thoraj Apr 7, 2024
f0973ef
Added test to ensure we canregister anduse experimental extensions
thoraj Apr 7, 2024
9e5b543
Fix linting and code-style issues
thoraj Apr 7, 2024
d1acc5f
Added test to ensure only on registration of experimental extensions
thoraj Apr 7, 2024
f6fc5d8
Added test toensure call to getDehydratedDeviceCallback()
thoraj Apr 7, 2024
a7c7388
Test what happens when there is no implementation
thoraj Apr 7, 2024
5f506e7
Iterating cryptoSetup tests
thoraj Apr 8, 2024
c55e3eb
Lint/prettier fix
thoraj Apr 8, 2024
de57bc7
Assert both branches when checking for dehydrationkey callback
thoraj Apr 8, 2024
a36e00e
Merge branch 'matrix-org:develop' into taj/cryptosetup
thoraj Apr 8, 2024
c70cfe9
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
e5ca4f6
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
3745e21
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
fba6f3e
Update test/MatrixClientPeg-test.ts
thoraj Apr 8, 2024
a38267b
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
a18c808
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
b939c2e
Update src/modules/ModuleRunner.ts
thoraj Apr 8, 2024
97f25ce
Simplify mock setup
thoraj Apr 8, 2024
fd9562f
Simplified mock and cleaned up a bit
thoraj Apr 8, 2024
8e7a2b4
Keeping track of extensions is an implementation detail internal to E…
thoraj Apr 8, 2024
82b4f82
Merge branch 'develop' into taj/cryptosetup
thoraj Apr 9, 2024
dbf7c29
Addressed issues and comments from PR review
thoraj Apr 9, 2024
c81ca70
Merge branch 'develop' into taj/cryptosetup
thoraj Apr 9, 2024
319dc09
Update src/modules/ModuleRunner.ts
thoraj Apr 11, 2024
dff0368
Merge branch 'develop' into taj/cryptosetup
thoraj Apr 11, 2024
7c7d238
Fix flattening of implementation map
thoraj Apr 11, 2024
ee14471
Update src/modules/ModuleRunner.ts
thoraj Apr 12, 2024
2ddf31f
Merge branch 'develop' into taj/cryptosetup
thoraj Apr 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/modules/ModuleRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ class ExtensionsManager {
private cryptoSetupExtension: ProvideCryptoSetupExtensions;
private experimentalExtension: ProvideExperimentalExtensions;

// Map to keep track of which extensions has been provided by modules.
private implementionMap = {
hasDefaultCryptoSetupExtension: true,
hasDefaultExperimentalExtension: true,
};
/** `true` if `cryptoSetupExtension` is the default implementation; `false` if it is implemented by a module. */
private hasDefaultCryptoSetupExtension = true;

/** `true` if `experimentalExtension` is the default implementation; `false` if it is implemented by a module. */
private hasDefaultExperimentalExtension = true;
/**
thoraj marked this conversation as resolved.
Show resolved Hide resolved
* Create a new instance.
*/
Expand Down Expand Up @@ -85,23 +84,23 @@ class ExtensionsManager {
public addExtensions(module: AppModule): void {
const runtimeModule = module.module;

/* Record the cryptoSetup extension if any */
/* Add the cryptoSetup extension if any */
if (runtimeModule.extensions?.cryptoSetup) {
if (this.implementionMap.hasDefaultCryptoSetupExtension) {
if (this.hasDefaultCryptoSetupExtension) {
this.cryptoSetupExtension = runtimeModule.extensions?.cryptoSetup;
this.implementionMap.hasDefaultCryptoSetupExtension = false;
this.hasDefaultCryptoSetupExtension = false;
} else {
throw new Error(
`adding cryptoSetup extension implementation from module ${runtimeModule.moduleName} but an implementation was already provided.`,
);
}
}

/* Record the experimental extension if any */
/* Add the experimental extension if any */
if (runtimeModule.extensions?.experimental) {
if (this.implementionMap.hasDefaultExperimentalExtension) {
if (this.hasDefaultExperimentalExtension) {
this.experimentalExtension = runtimeModule.extensions?.experimental;
this.implementionMap.hasDefaultExperimentalExtension = false;
this.hasDefaultExperimentalExtension = false;
} else {
throw new Error(
`adding experimental extension implementation from module ${runtimeModule.moduleName} but an implementation was already provided.`,
Expand Down
Loading