Skip to content
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

feat: display users and devices E2E identity verification badges #15575

Merged
merged 140 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
5846358
feat: add route for e2eIdentity Landingpage, add server redirect
aweiss-dev Apr 18, 2023
6f7031a
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev May 3, 2023
e6741e4
feat: add E2EI Feature flag
aweiss-dev May 3, 2023
b204266
feat: add info
aweiss-dev May 8, 2023
26179b5
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev May 8, 2023
faeccaa
wip
aweiss-dev May 16, 2023
58a70aa
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev May 17, 2023
a0aceeb
Merge branch dev into feat/e2ei_oicd
aweiss-dev May 30, 2023
9e5ad64
feat: add loading, error and done modals to the flow
aweiss-dev Jun 6, 2023
0d376a0
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Jun 6, 2023
c926073
fix: update ignore
aweiss-dev Jun 6, 2023
6ee8a57
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Jun 8, 2023
44b257b
featr: finish modal implementation and setup tests
aweiss-dev Jun 9, 2023
d30f36a
fix: remove yalc
aweiss-dev Jun 9, 2023
c314e58
chore: rename delayTimer callbacks for clarity
aweiss-dev Jun 9, 2023
2c29d56
Co-authored-by: Amir Ghezelbash <[email protected]>
aweiss-dev Jun 9, 2023
32c4789
feat: change redirect route from /auth/oidc to /auth to circumvent co…
aweiss-dev Jun 21, 2023
f1e2f3d
chore: merge dev into feat/e2ei_oicd
aweiss-dev Jun 26, 2023
53cf52d
fix: lockfile & types
aweiss-dev Jun 26, 2023
25e9728
feat: get the certificate is working
aweiss-dev Jul 4, 2023
953dcba
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Jul 4, 2023
e8f4369
feat: remove unused page
aweiss-dev Jul 17, 2023
33a59f4
Merge branch dev into feat/e2ei_oicd
aweiss-dev Jul 24, 2023
4790714
feat: change api of E2EI
aweiss-dev Aug 2, 2023
22804e1
feat: Conversations shields
przemvs Aug 7, 2023
c30f9ab
feat: clear uri from redirect valuesw
aweiss-dev Aug 9, 2023
05eeece
Prepare shields
przemvs Aug 11, 2023
b10fde0
remove unused files
przemvs Aug 11, 2023
460b1cf
update wire-web-packages and remove icons from wire-webapp
przemvs Aug 11, 2023
453fbc0
Merge branch dev into feat/e2ei_oicd
aweiss-dev Aug 22, 2023
233271b
refactor: move parts of the code out of webapp
aweiss-dev Aug 22, 2023
1ceb3ee
fix: router behaviour for oauth
aweiss-dev Aug 29, 2023
b00493f
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Aug 30, 2023
e704db0
feat: add base tests
przemvs Aug 31, 2023
97dc698
feat: add UI functionality (redirects) to thr webapp
aweiss-dev Sep 1, 2023
53641d3
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 4, 2023
20f27bf
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Sep 6, 2023
cdd8b3d
Merge branch 'dev' into feat/e2ei_oicd
przemvs Sep 11, 2023
1eb2d97
chore: rebuild yarn.lock
aweiss-dev Sep 11, 2023
551ec3f
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 11, 2023
ab760cc
Merge branch 'dev' into feat/e2ei_oicd
przemvs Sep 11, 2023
c3e9236
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 11, 2023
1040c0d
feat: add a new featureChangeHandler to start the E2EI flow
aweiss-dev Sep 11, 2023
3a7dd7b
feat: clear oidc progress at error
aweiss-dev Sep 13, 2023
74d3a65
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Sep 13, 2023
4c3cc5d
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 13, 2023
af7c30d
feat: replace url param after get certificate
przemvs Sep 14, 2023
5faceee
fix: clean up after success or failed try.
aweiss-dev Sep 14, 2023
f8a623b
chore: move util functions
aweiss-dev Sep 14, 2023
f7ea077
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 14, 2023
25db646
Merge branch 'dev' into feat/e2ei_oicd
przemvs Sep 18, 2023
6bcf4ff
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 18, 2023
84c8b83
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Sep 18, 2023
fab6e28
fix: yarn errors
aweiss-dev Sep 20, 2023
6b1d9fb
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Sep 20, 2023
fd6befb
feat: Show MLS Info on devices (#15637)
phoenixhdd Sep 26, 2023
d939f3d
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Sep 26, 2023
0f520e9
rename badges to verificationbadges
przemvs Oct 2, 2023
cf62d76
cr fixes
przemvs Oct 5, 2023
36341e9
feat: Show E2E Identity certificate info (#15677)
phoenixhdd Oct 5, 2023
e065716
fixes
przemvs Oct 6, 2023
d42bb22
feat: manage conversation verification state for mls [WPB-482] (#15889)
aweiss-dev Oct 9, 2023
aca029a
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Oct 11, 2023
53a3ff5
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Oct 11, 2023
5a2d89e
Merge branch 'feat/e2ei_oicd' of github.com:wireapp/wire-webapp into …
aweiss-dev Oct 11, 2023
6293589
Merge branch 'dev' into feat/e2ei_oicd
aweiss-dev Oct 11, 2023
9dc69be
Merge branch 'feat/e2ei_oicd' into feature/WPB-482-conversation-shields
przemvs Oct 12, 2023
eaf2643
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Oct 12, 2023
0999001
revert loadable component
przemvs Oct 12, 2023
426b51f
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Oct 13, 2023
2739596
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Oct 17, 2023
7aca32d
feat: Indicate client with valid certificate (#16018)
phoenixhdd Oct 17, 2023
49e4107
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Oct 18, 2023
906ba63
yarn.lock file update
przemvs Oct 18, 2023
4fcf441
yarn.lock file update
przemvs Oct 18, 2023
8be23fd
update yarn.locks
przemvs Oct 18, 2023
0d6f728
lint fixes
przemvs Oct 18, 2023
d265767
test fixes
przemvs Oct 18, 2023
3cb9655
Merge branch 'dev' into feature/WPB-482-conversation-shields
aweiss-dev Oct 20, 2023
1f12e35
feat: Add MLS Verification Badges (#16029)
phoenixhdd Oct 20, 2023
5b75197
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Nov 6, 2023
c63652a
test fixes
przemvs Nov 6, 2023
c8f58af
Add translations and fix section
przemvs Nov 6, 2023
6103fc2
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Nov 6, 2023
d537a7a
fix
przemvs Nov 7, 2023
32dbcba
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Nov 7, 2023
093b9b6
restore files from dev
przemvs Nov 7, 2023
37d012f
feat: Conversation shields improvements (#16163)
phoenixhdd Nov 8, 2023
b109a94
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Nov 8, 2023
9682a9d
revert unnecessary changes
przemvs Nov 8, 2023
199871e
feat: Prepare core e2ei service method (#16164)
phoenixhdd Nov 9, 2023
127cdfa
Merge branch 'dev' into feature/WPB-482-conversation-shields
przemvs Nov 10, 2023
937aa60
Merge branch 'dev' into feature/WPB-482-conversation-shields
atomrc Nov 13, 2023
ef94836
fix: Improve user verification badges computation (#16218)
atomrc Nov 15, 2023
a77de56
fix spelling of enroll
atomrc Nov 15, 2023
b818705
refactor: Use corecrypto to get devices verification state (#16220)
atomrc Nov 15, 2023
8f1b7a9
Merge branch 'dev' into feature/WPB-482-conversation-shields
atomrc Nov 16, 2023
cea50db
feat: rely on CoreCrypto to get device full identity (#16221)
atomrc Nov 16, 2023
81ad95b
fix: Do not show current device proteus verification state (#16222)
atomrc Nov 16, 2023
1351a5d
chore: Setup user verification badges (#16226)
atomrc Nov 20, 2023
3943102
feat: Show E2EI Verification system message (#16224)
phoenixhdd Nov 21, 2023
0de8ae3
chore(deps): Bump crowdin/github-action from 1.15.1 to 1.15.2 (#16227)
dependabot[bot] Nov 16, 2023
1f988e5
chore(deps): Bump @wireapp/commons from 5.2.2 to 5.2.3 in /server (#1…
dependabot[bot] Nov 19, 2023
e5cc93e
chore(deps-dev): Bump the eslint group with 2 updates (#16230)
dependabot[bot] Nov 19, 2023
447b3a6
chore(deps): Bump the datadog group with 2 updates (#16231)
dependabot[bot] Nov 19, 2023
cc0bdf1
chore(deps-dev): Bump @wireapp/copy-config from 2.1.10 to 2.1.11 (#16…
dependabot[bot] Nov 19, 2023
03a0403
chore(deps): Bump react-intl from 6.5.4 to 6.5.5 (#16233)
dependabot[bot] Nov 19, 2023
ccbe23b
chore(deps): Bump @lexical/react from 0.12.2 to 0.12.4 (#16235)
dependabot[bot] Nov 19, 2023
c7e50d1
chore(deps): Bump @wireapp/core from 42.19.2 to 42.20.0 (#16234)
dependabot[bot] Nov 19, 2023
c71c169
chore(deps-dev): Bump @types/node from 20.9.0 to 20.9.2 (#16239)
dependabot[bot] Nov 19, 2023
cf54302
chore(deps): Bump react-router-dom from 6.18.0 to 6.19.0 (#16242)
dependabot[bot] Nov 19, 2023
16e5288
chore(deps-dev): Bump @formatjs/cli from 6.2.3 to 6.2.4 (#16243)
dependabot[bot] Nov 19, 2023
5bd868c
chore(deps-dev): Bump @testing-library/react from 14.1.0 to 14.1.2 (#…
dependabot[bot] Nov 19, 2023
d7623a3
chore(deps): Bump @wireapp/commons from 5.2.2 to 5.2.3 (#16241)
dependabot[bot] Nov 19, 2023
fa73834
chore(deps): Bump @wireapp/react-ui-kit from 9.9.12 to 9.10.0 (#16245)
dependabot[bot] Nov 19, 2023
b976528
chore(deps): Bump react-router from 6.18.0 to 6.19.0 (#16236)
dependabot[bot] Nov 19, 2023
16ad25a
chore(deps-dev): Bump @faker-js/faker from 8.2.0 to 8.3.1 (#16246)
dependabot[bot] Nov 19, 2023
5dbb959
chore(deps): Bump @lexical/history from 0.12.2 to 0.12.4 (#16244)
dependabot[bot] Nov 19, 2023
3ed4c18
chore(deps): Bump lexical from 0.12.2 to 0.12.4 (#16238)
dependabot[bot] Nov 19, 2023
d1e8b3a
chore: Update translations (#16228)
otto-the-bot Nov 20, 2023
f445587
fix: do not hide conversation when its content is cleared (#16247)
PatrykBuniX Nov 20, 2023
db7474e
fix: show confirm modal when calling a conversation from wrapper top …
thisisamir98 Nov 20, 2023
2943b90
chore: Update translations (#16249)
otto-the-bot Nov 21, 2023
b1785e2
chore: cleanup applock extra observables (#16250)
atomrc Nov 21, 2023
d977382
runfix: cleared conversation visible (#16252)
PatrykBuniX Nov 21, 2023
55d65ce
feat: use backend provided idp (#16254)
aweiss-dev Nov 22, 2023
9b324f4
runfix: Correctly show user/devices verification state (#16253)
atomrc Nov 27, 2023
86c86c0
upgrade core
atomrc Nov 27, 2023
f8d8961
remove unused x509 certificate lib
atomrc Nov 27, 2023
14c72d7
feat(E2EI): add possibility to refresh a active certificate (#16288)
aweiss-dev Nov 28, 2023
8ee5d82
Merge branch 'dev' into feature/WPB-482-conversation-shields
atomrc Nov 28, 2023
711464f
Merge branch 'feature/WPB-482-conversation-shields' of github.com:wir…
atomrc Nov 28, 2023
19cf75b
hide e2ei badges when not in an e2ei env
atomrc Nov 28, 2023
b4bb753
fix: fix dark mode
atomrc Nov 28, 2023
bbcacfb
fix: fix mls envs
atomrc Nov 28, 2023
646b814
fix types
atomrc Nov 28, 2023
2436f5a
refactor: use hook for identity computation
atomrc Nov 28, 2023
9ffa14a
style improvements
atomrc Nov 29, 2023
492227a
revert gitignore changes
atomrc Nov 29, 2023
d9544cd
Merge branch 'dev' into feature/WPB-482-conversation-shields
atomrc Nov 29, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@peculiar/x509": "1.9.5",
"@wireapp/avs": "9.5.2",
"@wireapp/commons": "5.2.3",
"@wireapp/core": "42.21.0",
"@wireapp/core": "42.25.2",
"@wireapp/react-ui-kit": "9.12.0",
"@wireapp/store-engine-dexie": "2.1.6",
"@wireapp/webapp-events": "0.18.3",
Expand Down
1 change: 1 addition & 0 deletions server/config/client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@
SHOW_LOADING_INFORMATION: env.FEATURE_SHOW_LOADING_INFORMATION == 'true',
USE_CORE_CRYPTO: env.FEATURE_USE_CORE_CRYPTO == 'true',
MAX_USERS_TO_PING_WITHOUT_ALERT:
(env.FEATURE_MAX_USERS_TO_PING_WITHOUT_ALERT && Number(env.FEATURE_MAX_USERS_TO_PING_WITHOUT_ALERT)) || 4,

Check warning on line 73 in server/config/client.config.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 4
},
MAX_GROUP_PARTICIPANTS: (env.MAX_GROUP_PARTICIPANTS && Number(env.MAX_GROUP_PARTICIPANTS)) || 500,

Check warning on line 75 in server/config/client.config.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 500
MAX_VIDEO_PARTICIPANTS: (env.MAX_VIDEO_PARTICIPANTS && Number(env.MAX_VIDEO_PARTICIPANTS)) || 4,

Check warning on line 76 in server/config/client.config.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 4
NEW_PASSWORD_MINIMUM_LENGTH: (env.NEW_PASSWORD_MINIMUM_LENGTH && Number(env.NEW_PASSWORD_MINIMUM_LENGTH)) || 8,

Check warning on line 77 in server/config/client.config.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 8
URL: {
ACCOUNT_BASE: env.URL_ACCOUNT_BASE,
MOBILE_BASE: env.URL_MOBILE_BASE,
Expand All @@ -99,6 +99,7 @@
OAUTH_LEARN_MORE: env.URL_SUPPORT_OAUTH_LEARN_MORE,
OFFLINE_BACKEND: env.URL_SUPPORT_OFFLINE_BACKEND,
FEDERATION_STOP: env.URL_SUPPORT_FEDERATION_STOP,
E2EI_VERIFICATION: env.URL_SUPPORT_E2EI_VERIFICATION,
},
TEAMS_BASE: env.URL_TEAMS_BASE,
TEAMS_CREATE: env.URL_TEAMS_CREATE,
Expand Down
1 change: 1 addition & 0 deletions server/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export type Env = {
URL_SUPPORT_OFFLINE_BACKEND: string;

URL_SUPPORT_FEDERATION_STOP: string;
URL_SUPPORT_E2EI_VERIFICATION: string;

URL_WHATS_NEW: string;

Expand Down
14 changes: 14 additions & 0 deletions src/__mocks__/@wireapp/core-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
export interface CommitBundle {}
export enum PublicGroupStateEncryptionType {
Plaintext = 1,
JweEncrypted = 2,

Check warning on line 23 in src/__mocks__/@wireapp/core-crypto.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 2
}
export enum RatchetTreeType {
Full = 1,
Delta = 2,

Check warning on line 27 in src/__mocks__/@wireapp/core-crypto.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 2
ByRef = 3,

Check warning on line 28 in src/__mocks__/@wireapp/core-crypto.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 3
}
export enum Ciphersuite {
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,

Check warning on line 32 in src/__mocks__/@wireapp/core-crypto.ts

View workflow job for this annotation

GitHub Actions / lint

No magic number: 2
MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 = 4,
MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = 5,
Expand All @@ -41,3 +41,17 @@
Basic = 1,
X509 = 2,
}
export enum E2eiConversationState {
/**
* All clients have a valid E2EI certificate
*/
Verified = 1,
/**
* Some clients are either still Basic or their certificate is expired
*/
Degraded = 2,
/**
* All clients are still Basic. If all client have expired certificates, Degraded is returned.
*/
NotEnabled = 3,
}
17 changes: 13 additions & 4 deletions src/__mocks__/@wireapp/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ export class Account extends EventEmitter {
};

configureMLSCallbacks = jest.fn();

enrollE2EI = jest.fn();
service = {
e2eIdentity: {
isEnrollmentInProgress: jest.fn(),
clearAllProgress: jest.fn(),
hasActiveCertificate: jest.fn(),
getCertificateData: jest.fn(),
getUsersIdentities: jest.fn(() => new Map()),
getDeviceIdentities: jest.fn(),
getConversationState: jest.fn(),
},
mls: {
schedulePeriodicKeyMaterialRenewals: jest.fn(),
addUsersToExistingConversation: jest.fn(),
Expand All @@ -45,9 +54,9 @@ export class Account extends EventEmitter {
getClientIds: jest.fn(),
getEpoch: jest.fn(),
exportSecretKey: jest.fn(),
on: this.on,
emit: this.emit,
off: this.off,
on: jest.fn(),
emit: jest.fn(),
off: jest.fn(),
scheduleKeyMaterialRenewal: jest.fn(),
},
asset: {
Expand Down
49 changes: 43 additions & 6 deletions src/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,29 @@
"customEnvRedirect.credentialsInfo": "Provide credentials only if you're sure this is your organization's login.",
"customEnvRedirect.redirectHeadline": "Redirecting...",
"customEnvRedirect.redirectTo": "You are being redirected to your dedicated enterprise service.",
"downloadLatestMLS": "Download the latest MLS Wire version",
"E2EI.verified": "Verified (End-to-end Identity)",
"E2EI.deviceVerified": "Device verified (End-to-end identity)",
"E2EI.certificateExpired": "End-to-end identity certificate expired",
"E2EI.certificateExpiresSoon": "End-to-end identity certificate expires soon",
"E2EI.certificateRevoked": "End-to-end identity certificate revoked",
"E2EI.status": "Status: ",
"E2EI.certificateTitle": "End-to-end identity certificate",
"E2EI.valid": "Valid",
"E2EI.not_downloaded": "Not downloaded",
"E2EI.expired": "Expired",
"E2EI.expires_soon": "Valid (expires soon)",
"E2EI.not_activated": "Not activated",
"E2EI.serialNumber": "Serial number: ",
"E2EI.notAvailable": "Not available",
"E2EI.showCertificateDetails": "Show Certificate Details",
"E2EI.getCertificate": "Get Certificate",
"E2EI.updateCertificate": "Update Certificate",
"E2EI.certificateDetails": "Certificate details (PEM format)",
"E2EI.downloadCertificate": "Download",
"E2EI.copyCertificate": "Copy to Clipboard",
"E2EI.certificateCopied": "Text copied!",
"proteusVerifiedDetails": "Verified (Proteus)",
"proteusDeviceVerified": "Device verified (Proteus)",
"enumerationAnd": ", and ",
"ephemeralRemaining": "remaining",
"ephemeralUnitsDay": "day",
Expand Down Expand Up @@ -756,6 +778,12 @@
"mlsConversationRecovered": "You haven't used this device for a while, or an issue has occurred. Some older messages may not appear here.",
"mlsToggleInfo": "When this is on, conversation will use the new messaging layer security (MLS) protocol.",
"mlsToggleName": "MLS",
"mlsSignature": "MLS with {{signature}} Signature",
"mlsThumbprint": "MLS Thumbprint",
"selfNotSupportMLSMsgPart1": "You can't communicate with [bold]{{selfUserName}}[/bold] anymore, as your device doesn't support the suitable protocol.",
"downloadLatestMLS": "Download the latest MLS Wire version",
"selfNotSupportMLSMsgPart2": "to call, and send messages and files again.",
"otherUserNotSupportMLSMsg": "You can't communicate with [bold]{{participantName}}[/bold] anymore, as you two now use different protocols. When [bold]{{participantName}}[/bold] gets an update, you can call and send messages and files again.",
"modalAccountCreateAction": "OK",
"modalAccountCreateHeadline": "Create an account?",
"modalAccountCreateMessage": "By creating an account you will lose the conversation history in this guest room.",
Expand Down Expand Up @@ -1050,12 +1078,15 @@
"ongoingGroupAudioCall": "Ongoing conference call with {{conversationName}}.",
"ongoingGroupVideoCall": "Ongoing video conference call with {{conversationName}}, your camera is {{cameraStatus}}.",
"ongoingVideoCall": "Ongoing video call with {{conversationName}}, your camera is {{cameraStatus}}.",
"otherUserNotSupportMLSMsg": "You can't communicate with [bold]{{participantName}}[/bold] anymore, as you two now use different protocols. When [bold]{{participantName}}[/bold] gets an update, you can call and send messages and files again.",
"participantDevicesProteusDeviceVerification": "Proteus Device Verification",
"participantDevicesProteusKeyFingerprint": "Proteus Key Fingerprint",
"participantDevicesDetailHeadline": "Verify that this matches the fingerprint shown on [bold]{{user}}’s device[/bold].",
"participantDevicesDetailHowTo": "How do I do that?",
"participantDevicesDetailResetSession": "Reset session",
"participantDevicesDetailShowMyDevice": "Show my device fingerprint",
"preferencesDeviceDetailsVerificationStatus": "Verification Status",
"participantDevicesDetailVerify": "Verified",
"preferencesDeviceDetailsFingerprintNotMatch": "If fingerprints don’t match, reset the session to generate new encryption keys on both sides.",
"participantDevicesHeader": "Devices",
"participantDevicesHeadline": "{{brandName}} gives every device a unique fingerprint. Compare them with {{user}} and verify your conversation.",
"participantDevicesLearnMore": "Learn more",
Expand Down Expand Up @@ -1134,13 +1165,14 @@
"preferencesDeviceDetails": "Device Details",
"preferencesDeviceNotVerified": "not verified",
"preferencesDevices": "Devices",
"preferencesDevicesActivatedOn": "Activated [bold]{{date}}[/bold]",
"preferencesDevicesActivatedOn": "Activated",
"preferencesDevicesActive": "Active",
"preferencesDevicesActiveDetail": "If you don’t recognize a device above, remove it and reset your password.",
"preferencesDevicesCurrent": "Current",
"preferencesDevicesFingerprint": "Key fingerprint",
"preferencesDevicesFingerprintDetail": "{{brandName}} gives every device a unique fingerprint. Compare them and verify your devices and conversations.",
"preferencesDevicesId": "ID: ",
"preferencesMLSThumbprint": "MLS Thumbprint: ",
"preferencesDevicesRemove": "Remove Device",
"preferencesDevicesRemoveCancel": "Cancel",
"preferencesDevicesRemoveDetail": "Remove this device if you have stopped using it. You will be logged out of this device immediately.",
Expand Down Expand Up @@ -1194,6 +1226,10 @@
"preferencesOptionsPreviewsSendCheckbox": "Create previews for links you send",
"preferencesOptionsPreviewsSendDetail": "Previews may still be shown for links from other people.",
"preferencesOptionsUseDarkMode": "Dark theme",
"proteusDeviceDetails": "Proteus Device Details",
"proteusID": "Proteus ID",
"proteusVerified": "Verified",
"proteusNotVerified": "Not Verified",
"readReceiptsToggleInfo": "When this is on, people can see when their messages in this conversation are read.",
"readReceiptsToggleName": "Read receipts",
"receiptToggleInfo": "When this is on, people can see when their messages in this conversation are read.",
Expand Down Expand Up @@ -1250,8 +1286,6 @@
"searchTrySearch": "Find people by\nname or username",
"searchTrySearchFederation": "Find people in Wire by name or\n@username\n\nFind people from another domain\nby @username@domainname",
"searchTrySearchLearnMore": "Learn more",
"selfNotSupportMLSMsgPart1": "You can't communicate with [bold]{{selfUserName}}[/bold] anymore, as your device doesn't support the suitable protocol.",
"selfNotSupportMLSMsgPart2": "to call, and send messages and files again.",
"selfProfileImageAlt": "Your profile picture",
"servicesOptionsTitle": "Services",
"servicesRoomToggleInfo": "Open this conversation to services.",
Expand Down Expand Up @@ -1302,7 +1336,10 @@
"timedMessageDisclaimer": "Self-deleting messages will be turned on for all the participants in this conversation.",
"timedMessagesTitle": "Self-deleting messages",
"tooltipConversationAddImage": "Add picture",
"tooltipConversationAllVerified": "All fingerprints are verified",
"tooltipConversationAllVerified": "All fingerprints are verified (Proteus)",
"tooltipConversationAllDevicesVerified": "All device fingerprints verified (Proteus)",
"tooltipConversationAllE2EIVerified": "All devices are verified (end-to-end identity). [link]Learn more[/link]",
"tooltipConversationAllE2EIVerifiedShort": "All devices verified (end-to-end identity)",
"tooltipConversationCall": "Call",
"tooltipConversationDetailsAddPeople": "Add participants to conversation ({{shortcut}})",
"tooltipConversationDetailsRename": "Change conversation name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {Core} from 'src/script/service/CoreSingleton';
import {UserState} from 'src/script/user/UserState';
import * as util from 'Util/util';

import {E2EIHandler, E2EIHandlerStep} from './E2EIdentity';
import {E2EIHandler, E2EIHandlerStep} from './E2EIdentityEnrollment';
import {getModalOptions, ModalType} from './Modals';
import {OIDCService} from './OIDCService/OIDCService';

Expand All @@ -35,24 +35,7 @@ jest.mock('./OIDCService', () => ({
clearProgress: jest.fn(),
} as unknown as OIDCService),
}));
jest.mock('Util/util');
jest.mock('src/script/Config');
jest.mock('tsyringe');
jest.mock('src/script/service/CoreSingleton', () => {
return {
Core: jest.fn().mockImplementation(() => {
return {enrollE2EI: jest.fn()};
}),
};
});
jest.mock('src/script/user/UserState', () => {
return {
UserState: jest.fn().mockImplementation(() => {
return {self: jest.fn()};
}),
};
});
jest.mock('Components/Modals/PrimaryModal');

jest.mock('./Modals', () => ({
getModalOptions: jest.fn().mockReturnValue({
modalOptions: {},
Expand All @@ -65,53 +48,30 @@ jest.mock('./Modals', () => ({
ENROLL: 'enroll',
},
}));
jest.mock('src/script/service/CoreSingleton', () => ({
Core: jest.fn().mockImplementation(() => ({
enrollE2EI: jest.fn(),
})),
}));
jest.mock('src/script/user/UserState', () => ({
UserState: jest.fn().mockImplementation(() => ({
self: jest.fn(),
})),
}));

describe('E2EIHandler', () => {
const params = {discoveryUrl: 'http://example.com', gracePeriodInSeconds: 30};
const newParams = {discoveryUrl: 'http://new-example.com', gracePeriodInSeconds: 60};
const user = {name: () => 'John Doe', username: () => 'johndoe'};
let coreMock: Core;
let userStateMock: UserState;

beforeEach(() => {
(util.supportsMLS as jest.Mock).mockReturnValue(true);
jest.spyOn(util, 'supportsMLS').mockReturnValue(true);
// Reset the singleton instance before each test
E2EIHandler.resetInstance();
// Clear all mocks before each test
jest.clearAllMocks();
// Setup the Core and UserState services mocks
coreMock = new Core();
userStateMock = new UserState();
(userStateMock.self as unknown as jest.Mock).mockReturnValue({name: () => 'John Doe', username: () => 'johndoe'});
(coreMock.enrollE2EI as jest.Mock).mockResolvedValue(true);

(container.resolve as jest.Mock).mockImplementation(service => {
if (service === Core) {
return coreMock;
}
if (service === UserState) {
return userStateMock;
}
return null;
});

// Mock the Config service to return true for ENABLE_E2EI
(util.supportsMLS as jest.Mock).mockReturnValue(true);
Config.getConfig = jest.fn().mockReturnValue({FEATURE: {ENABLE_E2EI: true}});

// Mock the PrimaryModal service to return a mock modal
(PrimaryModal.show as jest.Mock).mockClear();
jest.spyOn(PrimaryModal, 'show');
(getModalOptions as jest.Mock).mockClear();

jest
.spyOn(container.resolve(UserState), 'self')
.mockReturnValue({name: () => 'John Doe', username: () => 'johndoe'});
jest.spyOn(container.resolve(Core), 'enrollE2EI').mockResolvedValue(true);
});

it('should create instance with valid params', () => {
Expand Down Expand Up @@ -143,48 +103,32 @@ describe('E2EIHandler', () => {
expect(instance['gracePeriodInMS']).toEqual(newParams.gracePeriodInSeconds * TimeInMillis.SECOND);
});

it('should return true when supportsMLS returns true and ENABLE_E2EI is true', () => {
const instance = E2EIHandler.getInstance(params);
expect(instance.isE2EIEnabled).toBe(true);
});

it('should return false when supportsMLS returns false', () => {
(util.supportsMLS as jest.Mock).mockReturnValue(false);

const instance = E2EIHandler.getInstance(params);
expect(instance.isE2EIEnabled).toBe(false);
});

it('should return false when ENABLE_E2EI is false', () => {
Config.getConfig = jest.fn().mockReturnValue({FEATURE: {ENABLE_E2EI: false}});

const instance = E2EIHandler.getInstance(params);
expect(instance.isE2EIEnabled).toBe(false);
});

it('should set currentStep to INITIALIZE after initialize is called', () => {
const instance = E2EIHandler.getInstance(params);
instance.initialize();
expect(instance['currentStep']).toBe(E2EIHandlerStep.INITIALIZED);
});

it('should set currentStep to ENROLL when enrollE2EI is called and enrollment succeeds', async () => {
it('should set currentStep to SUCCESS when enrollE2EI is called and enrollment succeeds', async () => {
jest
.spyOn(container.resolve(UserState), 'self')
.mockReturnValue({name: () => 'John Doe', username: () => 'johndoe'});

jest.spyOn(container.resolve(Core), 'enrollE2EI').mockResolvedValueOnce(true);

const instance = E2EIHandler.getInstance(params);
await instance['enrollE2EI']();
await instance['enroll']();

expect(instance['currentStep']).toBe(E2EIHandlerStep.SUCCESS);
});

it('should set currentStep to ERROR when enrollE2EI is called and enrollment fails', async () => {
it('should set currentStep to ERROR when enrolE2EI is called and enrolment fails', async () => {
// Mock the Core service to return an error
(container.resolve as any) = jest.fn(service => {
if (service === Core) {
return {enrollE2EI: jest.fn(() => Promise.reject())};
}
return {self: () => user};
});
jest.spyOn(container.resolve(Core), 'enrollE2EI').mockImplementationOnce(jest.fn(() => Promise.reject()));
jest.spyOn(container.resolve(UserState), 'self').mockImplementationOnce(() => user);

const instance = E2EIHandler.getInstance(params);
await instance['enrollE2EI']();
await instance['enroll']();
expect(instance['currentStep']).toBe(E2EIHandlerStep.ERROR);
});

Expand All @@ -198,9 +142,9 @@ describe('E2EIHandler', () => {
);
});

it('should display loading message when enrolled', async () => {
it('should display loading message when enroled', async () => {
const handler = E2EIHandler.getInstance(params);
await handler['enrollE2EI']();
await handler['enroll']();
expect(getModalOptions).toHaveBeenCalledWith(
expect.objectContaining({
type: ModalType.LOADING,
Expand All @@ -209,9 +153,11 @@ describe('E2EIHandler', () => {
});

it('should display success message when enrollment is done', async () => {
jest.spyOn(container.resolve(Core), 'enrollE2EI').mockResolvedValueOnce(true);

const handler = E2EIHandler.getInstance(params);
handler['showLoadingMessage'] = jest.fn();
await handler['enrollE2EI']();
await handler['enroll']();
expect(getModalOptions).toHaveBeenCalledWith(
expect.objectContaining({
type: ModalType.SUCCESS,
Expand All @@ -220,18 +166,11 @@ describe('E2EIHandler', () => {
});

it('should display error message when enrollment fails', async () => {
(container.resolve as jest.Mock).mockImplementation(service => {
if (service === Core) {
return {startE2EIEnrollment: jest.fn(() => Promise.reject(false))};
}
if (service === UserState) {
return userStateMock;
}
return null;
});
jest.spyOn(container.resolve(Core), 'enrollE2EI').mockRejectedValueOnce(false);

const handler = E2EIHandler.getInstance(params);
handler['showLoadingMessage'] = jest.fn();
await handler['enrollE2EI']();
await handler['enroll']();
expect(getModalOptions).toHaveBeenCalledWith(
expect.objectContaining({
type: ModalType.ERROR,
Expand Down
Loading
Loading