From e0e85c25a2e713a3d0b548e46a3e056812024393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Wed, 9 Apr 2025 15:33:32 +0100 Subject: [PATCH 01/16] [PM-16091] Add SsoExternalId to the member dialog and hide ExternalId if there is no value to display (#14126) * Add ssoExternalId to OrganizationUserAdminView and OrganizationUserDetailsResponse - Updated OrganizationUserAdminView to include ssoExternalId property. - Enhanced OrganizationUserDetailsResponse constructor to initialize ssoExternalId from response data. * Add SSO External ID copy to messages.json * Implement SSO External ID field in member dialog - Added a new input field for ssoExternalId in the member dialog component. - Introduced visibility logic for both externalId and ssoExternalId based on feature flags. - Updated form control initialization to include ssoExternalId. --- .../core/views/organization-user-admin-view.ts | 2 ++ .../member-dialog/member-dialog.component.html | 8 +++++++- .../member-dialog/member-dialog.component.ts | 18 ++++++++++++++++++ apps/web/src/locales/en/messages.json | 6 ++++++ .../responses/organization-user.response.ts | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/admin-console/organizations/core/views/organization-user-admin-view.ts b/apps/web/src/app/admin-console/organizations/core/views/organization-user-admin-view.ts index 10f2d483386..264e37c6bd3 100644 --- a/apps/web/src/app/admin-console/organizations/core/views/organization-user-admin-view.ts +++ b/apps/web/src/app/admin-console/organizations/core/views/organization-user-admin-view.ts @@ -17,6 +17,7 @@ export class OrganizationUserAdminView { type: OrganizationUserType; status: OrganizationUserStatusType; externalId: string; + ssoExternalId: string; permissions: PermissionsApi; resetPasswordEnrolled: boolean; hasMasterPassword: boolean; @@ -39,6 +40,7 @@ export class OrganizationUserAdminView { view.type = response.type; view.status = response.status; view.externalId = response.externalId; + view.ssoExternalId = response.ssoExternalId; view.permissions = response.permissions; view.resetPasswordEnrolled = response.resetPasswordEnrolled; view.collections = response.collections.map((c) => ({ diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html index db7422bd34b..8a6534c6c5a 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html @@ -177,11 +177,17 @@ - + {{ "externalId" | i18n }} {{ "externalIdDesc" | i18n }} + + + {{ "ssoExternalId" | i18n }} + + {{ "ssoExternalIdDesc" | i18n }} +
diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts index fac5d606946..bc7dff3e70b 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts @@ -125,6 +125,7 @@ export class MemberDialogComponent implements OnDestroy { emails: [""], type: OrganizationUserType.User, externalId: this.formBuilder.control({ value: "", disabled: true }), + ssoExternalId: this.formBuilder.control({ value: "", disabled: true }), accessSecretsManager: false, access: [[] as AccessItemValue[]], groups: [[] as AccessItemValue[]], @@ -155,6 +156,22 @@ export class MemberDialogComponent implements OnDestroy { FeatureFlag.AccountDeprovisioning, ); + protected isExternalIdVisible$ = this.configService + .getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility) + .pipe( + map((isEnabled) => { + return !isEnabled || !!this.formGroup.get("externalId")?.value; + }), + ); + + protected isSsoExternalIdVisible$ = this.configService + .getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility) + .pipe( + map((isEnabled) => { + return isEnabled && !!this.formGroup.get("ssoExternalId")?.value; + }), + ); + private destroy$ = new Subject(); get customUserTypeSelected(): boolean { @@ -402,6 +419,7 @@ export class MemberDialogComponent implements OnDestroy { this.formGroup.patchValue({ type: userDetails.type, externalId: userDetails.externalId, + ssoExternalId: userDetails.ssoExternalId, access: accessSelections, accessSecretsManager: userDetails.accessSecretsManager, groups: groupAccessSelections, diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 3300f73eb3b..3b63921935a 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -3345,6 +3345,12 @@ "externalIdDesc": { "message": "External ID is an unencrypted reference used by the Bitwarden Directory Connector and API." }, + "ssoExternalId": { + "message": "SSO External ID" + }, + "ssoExternalIdDesc": { + "message": "SSO External ID is an unencrypted reference between Bitwarden and your configured SSO provider." + }, "nestCollectionUnder": { "message": "Nest collection under" }, diff --git a/libs/admin-console/src/common/organization-user/models/responses/organization-user.response.ts b/libs/admin-console/src/common/organization-user/models/responses/organization-user.response.ts index 1e426696d92..97ff1637382 100644 --- a/libs/admin-console/src/common/organization-user/models/responses/organization-user.response.ts +++ b/libs/admin-console/src/common/organization-user/models/responses/organization-user.response.ts @@ -64,10 +64,12 @@ export class OrganizationUserUserDetailsResponse extends OrganizationUserRespons export class OrganizationUserDetailsResponse extends OrganizationUserResponse { managedByOrganization: boolean; + ssoExternalId: string; constructor(response: any) { super(response); this.managedByOrganization = this.getResponseProperty("ManagedByOrganization") ?? false; + this.ssoExternalId = this.getResponseProperty("SsoExternalId"); } } From c16534e1e72c31a1c3fbc59fac77fc3856b4d6f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:08:22 +0200 Subject: [PATCH 02/16] [deps]: Update Rust crate tokio to v1.43.1 [SECURITY] (#14170) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel García --- apps/desktop/desktop_native/Cargo.lock | 4 ++-- apps/desktop/desktop_native/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/desktop/desktop_native/Cargo.lock b/apps/desktop/desktop_native/Cargo.lock index 82259155b37..04bc4887ff7 100644 --- a/apps/desktop/desktop_native/Cargo.lock +++ b/apps/desktop/desktop_native/Cargo.lock @@ -2965,9 +2965,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.43.0" +version = "1.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" +checksum = "492a604e2fd7f814268a378409e6c92b5525d747d10db9a229723f55a417958c" dependencies = [ "backtrace", "bytes", diff --git a/apps/desktop/desktop_native/Cargo.toml b/apps/desktop/desktop_native/Cargo.toml index 9b1e5c2666c..01838359147 100644 --- a/apps/desktop/desktop_native/Cargo.toml +++ b/apps/desktop/desktop_native/Cargo.toml @@ -51,7 +51,7 @@ ssh-encoding = "=0.2.0" ssh-key = {version = "=0.6.7", default-features = false } sysinfo = "0.33.1" thiserror = "=1.0.69" -tokio = "=1.43.0" +tokio = "=1.43.1" tokio-stream = "=0.1.15" tokio-util = "=0.7.13" typenum = "=1.17.0" From 7e2cbbf6165afa7affdbc8f8ccb610bd20ad283b Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Wed, 9 Apr 2025 22:12:48 +0100 Subject: [PATCH 03/16] Fix Safari pinned tabs causing autofill to be wrong (#13755) Co-authored-by: Jonathan Prusik --- .../src/platform/browser/browser-api.spec.ts | 109 ++++++++++++++++++ .../src/platform/browser/browser-api.ts | 49 +++++++- 2 files changed, 156 insertions(+), 2 deletions(-) diff --git a/apps/browser/src/platform/browser/browser-api.spec.ts b/apps/browser/src/platform/browser/browser-api.spec.ts index f6bf7d4069b..49d3e8e1cec 100644 --- a/apps/browser/src/platform/browser/browser-api.spec.ts +++ b/apps/browser/src/platform/browser/browser-api.spec.ts @@ -589,4 +589,113 @@ describe("BrowserApi", () => { ); }); }); + + /* + * Safari sometimes returns >1 tabs unexpectedly even when + * specificing a `windowId` or `currentWindow: true` query option. + * + * For example, when there are >=2 windows with an active pinned tab, + * the pinned tab will always be included as the first entry in the array, + * while the correct tab is included as the second entry. + * + * These tests can remain as verification when Safari fixes this bug. + */ + describe.each([{ isSafariApi: true }, { isSafariApi: false }])( + "SafariTabsQuery %p", + ({ isSafariApi }) => { + let originalIsSafariApi = BrowserApi.isSafariApi; + const expectedWindowId = 10; + const wrongWindowId = expectedWindowId + 1; + const raceConditionWindowId = expectedWindowId + 2; + const mismatchedWindowId = expectedWindowId + 3; + + const resolvedTabsQueryResult = [ + mock({ + title: "tab[0] is a pinned tab from another window", + pinned: true, + windowId: wrongWindowId, + }), + mock({ + title: "tab[1] is the tab with the correct foreground window", + windowId: expectedWindowId, + }), + ]; + + function mockCurrentWindowId(id: number | null) { + jest + .spyOn(BrowserApi, "getCurrentWindow") + .mockResolvedValue(mock({ id })); + } + + beforeEach(() => { + originalIsSafariApi = BrowserApi.isSafariApi; + BrowserApi.isSafariApi = isSafariApi; + mockCurrentWindowId(expectedWindowId); + jest.spyOn(BrowserApi, "tabsQuery").mockResolvedValue(resolvedTabsQueryResult); + }); + + afterEach(() => { + BrowserApi.isSafariApi = originalIsSafariApi; + jest.restoreAllMocks(); + }); + + describe.each([BrowserApi.getTabFromCurrentWindow, BrowserApi.getTabFromCurrentWindowId])( + "%p", + (getCurrTabFn) => { + it("returns the first tab when the query result has one tab", async () => { + const expectedSingleTab = resolvedTabsQueryResult[0]; + jest.spyOn(BrowserApi, "tabsQuery").mockResolvedValue([expectedSingleTab]); + const actualTab = await getCurrTabFn(); + expect(actualTab).toBe(expectedSingleTab); + }); + + it("returns the first tab when the current window ID is mismatched", async () => { + mockCurrentWindowId(mismatchedWindowId); + const actualTab = await getCurrTabFn(); + expect(actualTab).toBe(resolvedTabsQueryResult[0]); + }); + + it("returns the first tab when the current window ID is unavailable", async () => { + mockCurrentWindowId(null); + const actualTab = await getCurrTabFn(); + expect(actualTab).toBe(resolvedTabsQueryResult[0]); + }); + + if (isSafariApi) { + it("returns the tab with the current window ID", async () => { + const actualTab = await getCurrTabFn(); + expect(actualTab.windowId).toBe(expectedWindowId); + }); + + it(`returns the tab with the current window ID at the time of calling [Function ${getCurrTabFn.name}]`, async () => { + jest.spyOn(BrowserApi, "tabsQuery").mockImplementation(() => { + /* + * Simulate rapid clicking/switching between windows, e.g. + * 1. From Window A, call `getCurrTabFn()` + * 2. getCurrTabFn() calls `await BrowserApi.tabsQuery()` + * 3. Users switches to Window B before the `await` returns + * 4. getCurrTabFn() calls `await BrowserApi.getCurrentWindow()` + * ^ This now returns Window B and filters the results erroneously + */ + mockCurrentWindowId(raceConditionWindowId); + + return Promise.resolve(resolvedTabsQueryResult); + }); + + const actualTab = await getCurrTabFn(); + expect(actualTab.windowId).toBe(expectedWindowId); + }); + } /* !isSafariApi */ else { + it("falls back to tabsQueryFirst", async () => { + const tabsQueryFirstSpy = jest.spyOn(BrowserApi, "tabsQueryFirst"); + const actualTab = await getCurrTabFn(); + + expect(tabsQueryFirstSpy).toHaveBeenCalled(); + expect(actualTab).toBe(resolvedTabsQueryResult[0]); + }); + } + }, + ); + }, + ); }); diff --git a/apps/browser/src/platform/browser/browser-api.ts b/apps/browser/src/platform/browser/browser-api.ts index ec16c883bfb..4b4cec7e7da 100644 --- a/apps/browser/src/platform/browser/browser-api.ts +++ b/apps/browser/src/platform/browser/browser-api.ts @@ -125,7 +125,7 @@ export class BrowserApi { } static async getTabFromCurrentWindowId(): Promise | null { - return await BrowserApi.tabsQueryFirst({ + return await BrowserApi.tabsQueryFirstCurrentWindowForSafari({ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT, }); @@ -153,7 +153,7 @@ export class BrowserApi { } static async getTabFromCurrentWindow(): Promise | null { - return await BrowserApi.tabsQueryFirst({ + return await BrowserApi.tabsQueryFirstCurrentWindowForSafari({ active: true, currentWindow: true, }); @@ -197,6 +197,51 @@ export class BrowserApi { return null; } + /** + * Drop-in replacement for {@link BrowserApi.tabsQueryFirst}. + * + * Safari sometimes returns >1 tabs unexpectedly even when + * specificing a `windowId` or `currentWindow: true` query option. + * + * For all of these calls, + * ``` + * await chrome.tabs.query({active: true, currentWindow: true}) + * await chrome.tabs.query({active: true, windowId: chrome.windows.WINDOW_ID_CURRENT}) + * await chrome.tabs.query({active: true, windowId: 10}) + * ``` + * + * Safari could return: + * ``` + * [ + * {windowId: 2, pinned: true, title: "Incorrect tab in another window", …}, + * {windowId: 10, title: "Correct tab in foreground", …}, + * ] + * ``` + * + * This function captures the current window ID manually before running the query, + * then finds and returns the tab with the matching window ID. + * + * See the `SafariTabsQuery` tests in `browser-api.spec.ts`. + * + * This workaround can be removed when Safari fixes this bug. + */ + static async tabsQueryFirstCurrentWindowForSafari( + options: chrome.tabs.QueryInfo, + ): Promise | null { + if (!BrowserApi.isSafariApi) { + return await BrowserApi.tabsQueryFirst(options); + } + + const currentWindowId = (await BrowserApi.getCurrentWindow()).id; + const tabs = await BrowserApi.tabsQuery(options); + + if (tabs.length <= 1 || currentWindowId == null) { + return tabs[0]; + } + + return tabs.find((t) => t.windowId === currentWindowId) ?? tabs[0]; + } + static tabSendMessageData( tab: chrome.tabs.Tab, command: string, From 46470cce2a36b5ea8b06d6e714741189daa53a5c Mon Sep 17 00:00:00 2001 From: Jeffrey Holland <124393578+jholland-livefront@users.noreply.github.com> Date: Thu, 10 Apr 2025 08:08:13 +0200 Subject: [PATCH 04/16] PM-19102 Autofill new identity information in the popout (#13822) * PM-17187 Autofill new card information in the popout * Add new identity autofill to browser extension * Add ability to save values from autoselect fields --- .../autofill-overlay-content.service.ts | 2 +- .../add-edit/add-edit-v2.component.ts | 74 +++++++++++++++++++ .../cipher-form-config.service.ts | 19 +++++ .../components/identity/identity.component.ts | 48 ++++++++++++ 4 files changed, 142 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 6757972e839..55260cc1149 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -840,7 +840,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ return; } - const clonedNode = formFieldElement.cloneNode() as FillableFormFieldElement; + const clonedNode = formFieldElement.cloneNode(true) as FillableFormFieldElement; const identityLoginFields: AutofillFieldQualifierType[] = [ AutofillFieldQualifier.identityUsername, AutofillFieldQualifier.identityEmail, diff --git a/apps/browser/src/vault/popup/components/vault-v2/add-edit/add-edit-v2.component.ts b/apps/browser/src/vault/popup/components/vault-v2/add-edit/add-edit-v2.component.ts index f986bdfca31..30fd57a6bc6 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/add-edit/add-edit-v2.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/add-edit/add-edit-v2.component.ts @@ -488,5 +488,79 @@ const mapAddEditCipherInfoToInitialValues = ( initialValues.username = cipher.identity.username; } + if (cipher.type == CipherType.Identity) { + const identity = cipher.identity; + + if (identity != null) { + if (identity.title != null) { + initialValues.title = identity.title; + } + + if (identity.firstName != null) { + initialValues.firstName = identity.firstName; + } + + if (identity.middleName != null) { + initialValues.middleName = identity.middleName; + } + + if (identity.lastName != null) { + initialValues.lastName = identity.lastName; + } + + if (identity.company != null) { + initialValues.company = identity.company; + } + + if (identity.ssn != null) { + initialValues.ssn = identity.ssn; + } + + if (identity.passportNumber != null) { + initialValues.passportNumber = identity.passportNumber; + } + + if (identity.licenseNumber != null) { + initialValues.licenseNumber = identity.licenseNumber; + } + + if (identity.email != null) { + initialValues.email = identity.email; + } + + if (identity.phone != null) { + initialValues.phone = identity.phone; + } + + if (identity.address1 != null) { + initialValues.address1 = identity.address1; + } + + if (identity.address2 != null) { + initialValues.address2 = identity.address2; + } + + if (identity.address3 != null) { + initialValues.address3 = identity.address3; + } + + if (identity.city != null) { + initialValues.city = identity.city; + } + + if (identity.state != null) { + initialValues.state = identity.state; + } + + if (identity.postalCode != null) { + initialValues.postalCode = identity.postalCode; + } + + if (identity.country != null) { + initialValues.country = identity.country; + } + } + } + return initialValues; }; diff --git a/libs/vault/src/cipher-form/abstractions/cipher-form-config.service.ts b/libs/vault/src/cipher-form/abstractions/cipher-form-config.service.ts index 8a16050804b..639cf562caa 100644 --- a/libs/vault/src/cipher-form/abstractions/cipher-form-config.service.ts +++ b/libs/vault/src/cipher-form/abstractions/cipher-form-config.service.ts @@ -25,11 +25,30 @@ export type OptionalInitialValues = { username?: string; password?: string; name?: string; + // Credit Card Information cardholderName?: string; number?: string; expMonth?: string; expYear?: string; code?: string; + // Identity Information + title?: string; + firstName?: string; + middleName?: string; + lastName?: string; + company?: string; + ssn?: string; + passportNumber?: string; + licenseNumber?: string; + email?: string; + phone?: string; + address1?: string; + address2?: string; + address3?: string; + city?: string; + state?: string; + postalCode?: string; + country?: string; }; /** diff --git a/libs/vault/src/cipher-form/components/identity/identity.component.ts b/libs/vault/src/cipher-form/components/identity/identity.component.ts index 2d0608bf38a..02bee40c2c7 100644 --- a/libs/vault/src/cipher-form/components/identity/identity.component.ts +++ b/libs/vault/src/cipher-form/components/identity/identity.component.ts @@ -73,6 +73,10 @@ export class IdentitySectionComponent implements OnInit { country: [""], }); + get initialValues() { + return this.cipherFormContainer.config.initialValues; + } + constructor( private cipherFormContainer: CipherFormContainer, private formBuilder: FormBuilder, @@ -116,14 +120,58 @@ export class IdentitySectionComponent implements OnInit { const prefillCipher = this.cipherFormContainer.getInitialCipherView(); if (prefillCipher) { + this.initFromExistingCipher(prefillCipher.identity); this.populateFormData(prefillCipher); } else { + this.initNewCipher(); this.identityForm.patchValue({ username: this.cipherFormContainer.config.initialValues?.username || "", }); } } + private initFromExistingCipher(existingIdentity: IdentityView) { + this.identityForm.patchValue({ + firstName: this.initialValues.firstName ?? existingIdentity.firstName, + middleName: this.initialValues.middleName ?? existingIdentity.middleName, + lastName: this.initialValues.lastName ?? existingIdentity.lastName, + company: this.initialValues.company ?? existingIdentity.company, + ssn: this.initialValues.ssn ?? existingIdentity.ssn, + passportNumber: this.initialValues.passportNumber ?? existingIdentity.passportNumber, + licenseNumber: this.initialValues.licenseNumber ?? existingIdentity.licenseNumber, + email: this.initialValues.email ?? existingIdentity.email, + phone: this.initialValues.phone ?? existingIdentity.phone, + address1: this.initialValues.address1 ?? existingIdentity.address1, + address2: this.initialValues.address2 ?? existingIdentity.address2, + address3: this.initialValues.address3 ?? existingIdentity.address3, + city: this.initialValues.city ?? existingIdentity.city, + state: this.initialValues.state ?? existingIdentity.state, + postalCode: this.initialValues.postalCode ?? existingIdentity.postalCode, + country: this.initialValues.country ?? existingIdentity.country, + }); + } + + private initNewCipher() { + this.identityForm.patchValue({ + firstName: this.initialValues?.firstName || "", + middleName: this.initialValues?.middleName || "", + lastName: this.initialValues?.lastName || "", + company: this.initialValues?.company || "", + ssn: this.initialValues?.ssn || "", + passportNumber: this.initialValues?.passportNumber || "", + licenseNumber: this.initialValues?.licenseNumber || "", + email: this.initialValues?.email || "", + phone: this.initialValues?.phone || "", + address1: this.initialValues?.address1 || "", + address2: this.initialValues?.address2 || "", + address3: this.initialValues?.address3 || "", + city: this.initialValues?.city || "", + state: this.initialValues?.state || "", + postalCode: this.initialValues?.postalCode || "", + country: this.initialValues?.country || "", + }); + } + populateFormData(cipherView: CipherView) { const { identity } = cipherView; From 5a1b0744f0a357844efdac24879ede9bdb9f4f83 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Thu, 10 Apr 2025 11:09:35 +0200 Subject: [PATCH 05/16] [PM-17665] Move cryptofunction service to km (#13285) * Move cryptofunction service to km * Fix formatting * Fix import * Fix build on desktop * Fix build on browser and tests --- .github/CODEOWNERS | 2 +- .../login/extension-login-component.service.spec.ts | 2 +- .../popup/login/extension-login-component.service.ts | 2 +- apps/browser/src/background/main.background.ts | 4 ++-- .../src/background/nativeMessaging.background.ts | 2 +- apps/browser/src/popup/services/services.module.ts | 4 ++-- apps/cli/src/auth/commands/login.command.ts | 2 +- apps/cli/src/auth/commands/unlock.command.ts | 2 +- apps/cli/src/tools/send/commands/receive.command.ts | 2 +- .../app/services/renderer-crypto-function.service.ts | 4 ++-- apps/desktop/src/app/services/services.module.ts | 2 +- .../login/desktop-login-component.service.spec.ts | 2 +- .../src/auth/login/desktop-login-component.service.ts | 2 +- .../src/platform/main/main-crypto-function.service.ts | 2 +- .../src/platform/services/electron-key.service.ts | 2 +- .../biometric-message-handler.service.spec.ts | 2 +- .../src/services/biometric-message-handler.service.ts | 2 +- .../services/duckduckgo-message-handler.service.ts | 2 +- .../app/auth/core/services/link-sso.service.spec.ts | 2 +- .../src/app/auth/core/services/link-sso.service.ts | 2 +- .../login/web-login-component.service.spec.ts | 2 +- .../services/login/web-login-component.service.ts | 2 +- apps/web/src/app/core/core.module.ts | 2 +- .../app/tools/send/send-access/access.component.ts | 2 +- .../domain-add-edit-dialog.component.ts | 2 +- .../angular/src/auth/components/sso.component.spec.ts | 2 +- libs/angular/src/auth/components/sso.component.ts | 2 +- libs/angular/src/services/jslib-services.module.ts | 4 ++-- .../login-via-auth-request.component.ts | 2 +- .../login/default-login-component.service.spec.ts | 4 ++-- .../angular/login/default-login-component.service.ts | 2 +- libs/auth/src/angular/sso/sso.component.ts | 2 +- .../common/services/pin/pin.service.implementation.ts | 2 +- libs/auth/src/common/services/pin/pin.service.spec.ts | 2 +- .../webauthn-login-prf-key.service.spec.ts | 2 +- .../webauthn-login/webauthn-login-prf-key.service.ts | 2 +- .../crypto}/abstractions/crypto-function.service.ts | 9 ++++++--- .../bulk-encrypt.service.impementation.spec.ts | 2 +- .../services/bulk-encrypt.service.implementation.ts | 2 +- .../crypto/services/encrypt.service.implementation.ts | 2 +- .../crypto/services/encrypt.service.spec.ts | 2 +- .../key-management/crypto/services/encrypt.worker.ts | 2 +- ...multithread-encrypt.service.implementation.spec.ts | 2 +- .../services/web-crypto-function.service.spec.ts | 8 ++++---- .../crypto}/services/web-crypto-function.service.ts | 11 +++++++---- .../services/device-trust.service.implementation.ts | 2 +- .../services/device-trust.service.spec.ts | 2 +- .../platform/services/key-generation.service.spec.ts | 2 +- .../src/platform/services/key-generation.service.ts | 2 +- libs/common/src/services/audit.service.ts | 2 +- .../lastpass/lastpass-direct-import.service.ts | 2 +- .../lastpass/access/services/crypto-utils.ts | 2 +- .../src/importers/lastpass/access/services/parser.ts | 2 +- libs/importer/src/importers/lastpass/access/vault.ts | 2 +- libs/key-management/src/key.service.spec.ts | 2 +- libs/key-management/src/key.service.ts | 2 +- .../node/src/services/node-crypto-function.service.ts | 2 +- .../src/services/base-vault-export.service.ts | 2 +- .../services/individual-vault-export.service.spec.ts | 2 +- .../src/services/individual-vault-export.service.ts | 2 +- .../src/services/org-vault-export.service.ts | 2 +- .../src/services/vault-export.service.spec.ts | 2 +- 62 files changed, 81 insertions(+), 75 deletions(-) rename libs/common/src/{platform => key-management/crypto}/abstractions/crypto-function.service.ts (91%) rename libs/common/src/{platform => key-management/crypto}/services/web-crypto-function.service.spec.ts (98%) rename libs/common/src/{platform => key-management/crypto}/services/web-crypto-function.service.ts (97%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 37591ae5c36..6c7c43c4dac 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -84,7 +84,7 @@ libs/common/spec @bitwarden/team-platform-dev libs/common/src/state-migrations @bitwarden/team-platform-dev libs/platform @bitwarden/team-platform-dev # Node-specifc platform files -libs/node @bitwarden/team-platform-dev +libs/node @bitwarden/team-key-management-dev # Web utils used across app and connectors apps/web/src/utils/ @bitwarden/team-platform-dev # Web core and shared files diff --git a/apps/browser/src/auth/popup/login/extension-login-component.service.spec.ts b/apps/browser/src/auth/popup/login/extension-login-component.service.spec.ts index ee940952852..6d1f0571ae7 100644 --- a/apps/browser/src/auth/popup/login/extension-login-component.service.spec.ts +++ b/apps/browser/src/auth/popup/login/extension-login-component.service.spec.ts @@ -6,7 +6,7 @@ import { DefaultLoginComponentService } from "@bitwarden/auth/angular"; import { SsoUrlService } from "@bitwarden/auth/common"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Environment, EnvironmentService, diff --git a/apps/browser/src/auth/popup/login/extension-login-component.service.ts b/apps/browser/src/auth/popup/login/extension-login-component.service.ts index 9ed727ade33..49ed0635b7a 100644 --- a/apps/browser/src/auth/popup/login/extension-login-component.service.ts +++ b/apps/browser/src/auth/popup/login/extension-login-component.service.ts @@ -6,7 +6,7 @@ import { firstValueFrom } from "rxjs"; import { DefaultLoginComponentService, LoginComponentService } from "@bitwarden/auth/angular"; import { SsoUrlService } from "@bitwarden/auth/common"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy"; diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index aeee58c6fdf..709d64f2094 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -71,11 +71,13 @@ import { DefaultBillingAccountProfileStateService } from "@bitwarden/common/bill import { ClientType } from "@bitwarden/common/enums"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service"; +import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { BulkEncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/bulk-encrypt.service.implementation"; import { EncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/encrypt.service.implementation"; import { FallbackBulkEncryptService } from "@bitwarden/common/key-management/crypto/services/fallback-bulk-encrypt.service"; import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/multithread-encrypt.service.implementation"; +import { WebCryptoFunctionService } from "@bitwarden/common/key-management/crypto/services/web-crypto-function.service"; import { DeviceTrustServiceAbstraction } from "@bitwarden/common/key-management/device-trust/abstractions/device-trust.service.abstraction"; import { DeviceTrustService } from "@bitwarden/common/key-management/device-trust/services/device-trust.service.implementation"; import { KeyConnectorService as KeyConnectorServiceAbstraction } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service"; @@ -91,7 +93,6 @@ import { import { AppIdService as AppIdServiceAbstraction } from "@bitwarden/common/platform/abstractions/app-id.service"; import { ConfigApiServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config-api.service.abstraction"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { RegionConfig } from "@bitwarden/common/platform/abstractions/environment.service"; import { Fido2ActiveRequestManager as Fido2ActiveRequestManagerAbstraction } from "@bitwarden/common/platform/abstractions/fido2/fido2-active-request-manager.abstraction"; import { Fido2AuthenticatorService as Fido2AuthenticatorServiceAbstraction } from "@bitwarden/common/platform/abstractions/fido2/fido2-authenticator.service.abstraction"; @@ -146,7 +147,6 @@ import { NoopSdkClientFactory } from "@bitwarden/common/platform/services/sdk/no import { StateService } from "@bitwarden/common/platform/services/state.service"; import { SystemService } from "@bitwarden/common/platform/services/system.service"; import { UserAutoUnlockKeyService } from "@bitwarden/common/platform/services/user-auto-unlock-key.service"; -import { WebCryptoFunctionService } from "@bitwarden/common/platform/services/web-crypto-function.service"; import { ActiveUserStateProvider, DerivedStateProvider, diff --git a/apps/browser/src/background/nativeMessaging.background.ts b/apps/browser/src/background/nativeMessaging.background.ts index 69521228bc5..d92826765db 100644 --- a/apps/browser/src/background/nativeMessaging.background.ts +++ b/apps/browser/src/background/nativeMessaging.background.ts @@ -2,9 +2,9 @@ import { delay, filter, firstValueFrom, from, map, race, timer } from "rxjs"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 1c907f18f83..dad4e887a12 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -63,7 +63,9 @@ import { } from "@bitwarden/common/autofill/services/user-notification-settings.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; import { ClientType } from "@bitwarden/common/enums"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; +import { WebCryptoFunctionService } from "@bitwarden/common/key-management/crypto/services/web-crypto-function.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { VaultTimeoutService, @@ -74,7 +76,6 @@ import { DefaultAnimationControlService, } from "@bitwarden/common/platform/abstractions/animation-control.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -101,7 +102,6 @@ import { ContainerService } from "@bitwarden/common/platform/services/container. import { DefaultSdkClientFactory } from "@bitwarden/common/platform/services/sdk/default-sdk-client-factory"; import { NoopSdkClientFactory } from "@bitwarden/common/platform/services/sdk/noop-sdk-client-factory"; import { StorageServiceProvider } from "@bitwarden/common/platform/services/storage-service.provider"; -import { WebCryptoFunctionService } from "@bitwarden/common/platform/services/web-crypto-function.service"; import { DerivedStateProvider, GlobalStateProvider, diff --git a/apps/cli/src/auth/commands/login.command.ts b/apps/cli/src/auth/commands/login.command.ts index 107afc6dc8d..8d66a566038 100644 --- a/apps/cli/src/auth/commands/login.command.ts +++ b/apps/cli/src/auth/commands/login.command.ts @@ -31,9 +31,9 @@ import { TwoFactorEmailRequest } from "@bitwarden/common/auth/models/request/two import { UpdateTempPasswordRequest } from "@bitwarden/common/auth/models/request/update-temp-password.request"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; import { ClientType } from "@bitwarden/common/enums"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { KeyConnectorService } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/cli/src/auth/commands/unlock.command.ts b/apps/cli/src/auth/commands/unlock.command.ts index 34546f3d56f..6d524759dd6 100644 --- a/apps/cli/src/auth/commands/unlock.command.ts +++ b/apps/cli/src/auth/commands/unlock.command.ts @@ -7,9 +7,9 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; import { VerificationType } from "@bitwarden/common/auth/enums/verification-type"; import { MasterPasswordVerification } from "@bitwarden/common/auth/types/verification"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { KeyConnectorService } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { ConsoleLogService } from "@bitwarden/common/platform/services/console-log.service"; diff --git a/apps/cli/src/tools/send/commands/receive.command.ts b/apps/cli/src/tools/send/commands/receive.command.ts index 879d03f6dae..c67b4213d97 100644 --- a/apps/cli/src/tools/send/commands/receive.command.ts +++ b/apps/cli/src/tools/send/commands/receive.command.ts @@ -5,9 +5,9 @@ import * as inquirer from "inquirer"; import { firstValueFrom } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/desktop/src/app/services/renderer-crypto-function.service.ts b/apps/desktop/src/app/services/renderer-crypto-function.service.ts index ee80dc25933..8f109e0613f 100644 --- a/apps/desktop/src/app/services/renderer-crypto-function.service.ts +++ b/apps/desktop/src/app/services/renderer-crypto-function.service.ts @@ -1,5 +1,5 @@ -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; -import { WebCryptoFunctionService } from "@bitwarden/common/platform/services/web-crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; +import { WebCryptoFunctionService } from "@bitwarden/common/key-management/crypto/services/web-crypto-function.service"; export class RendererCryptoFunctionService extends WebCryptoFunctionService diff --git a/apps/desktop/src/app/services/services.module.ts b/apps/desktop/src/app/services/services.module.ts index db28f01f27a..cfab600505e 100644 --- a/apps/desktop/src/app/services/services.module.ts +++ b/apps/desktop/src/app/services/services.module.ts @@ -52,6 +52,7 @@ import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/ import { AutofillSettingsServiceAbstraction } from "@bitwarden/common/autofill/services/autofill-settings.service"; import { ClientType } from "@bitwarden/common/enums"; import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service"; +import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { DefaultProcessReloadService } from "@bitwarden/common/key-management/services/default-process-reload.service"; @@ -60,7 +61,6 @@ import { VaultTimeoutStringType, } from "@bitwarden/common/key-management/vault-timeout"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { Fido2AuthenticatorService as Fido2AuthenticatorServiceAbstraction } from "@bitwarden/common/platform/abstractions/fido2/fido2-authenticator.service.abstraction"; import { Fido2UserInterfaceService as Fido2UserInterfaceServiceAbstraction } from "@bitwarden/common/platform/abstractions/fido2/fido2-user-interface.service.abstraction"; diff --git a/apps/desktop/src/auth/login/desktop-login-component.service.spec.ts b/apps/desktop/src/auth/login/desktop-login-component.service.spec.ts index 914dc73bfd2..94bc73d2e93 100644 --- a/apps/desktop/src/auth/login/desktop-login-component.service.spec.ts +++ b/apps/desktop/src/auth/login/desktop-login-component.service.spec.ts @@ -6,7 +6,7 @@ import { DefaultLoginComponentService } from "@bitwarden/auth/angular"; import { SsoUrlService } from "@bitwarden/auth/common"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Environment, EnvironmentService, diff --git a/apps/desktop/src/auth/login/desktop-login-component.service.ts b/apps/desktop/src/auth/login/desktop-login-component.service.ts index 89407b0d4bc..7341e0fe039 100644 --- a/apps/desktop/src/auth/login/desktop-login-component.service.ts +++ b/apps/desktop/src/auth/login/desktop-login-component.service.ts @@ -6,7 +6,7 @@ import { firstValueFrom } from "rxjs"; import { DefaultLoginComponentService, LoginComponentService } from "@bitwarden/auth/angular"; import { DESKTOP_SSO_CALLBACK, SsoUrlService } from "@bitwarden/auth/common"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/apps/desktop/src/platform/main/main-crypto-function.service.ts b/apps/desktop/src/platform/main/main-crypto-function.service.ts index 2fc3fde1db2..0751f6b3a85 100644 --- a/apps/desktop/src/platform/main/main-crypto-function.service.ts +++ b/apps/desktop/src/platform/main/main-crypto-function.service.ts @@ -1,6 +1,6 @@ import { ipcMain } from "electron"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { crypto } from "@bitwarden/desktop-napi"; import { NodeCryptoFunctionService } from "@bitwarden/node/services/node-crypto-function.service"; diff --git a/apps/desktop/src/platform/services/electron-key.service.ts b/apps/desktop/src/platform/services/electron-key.service.ts index e378f3cf374..d272a9a9bd3 100644 --- a/apps/desktop/src/platform/services/electron-key.service.ts +++ b/apps/desktop/src/platform/services/electron-key.service.ts @@ -1,8 +1,8 @@ import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/apps/desktop/src/services/biometric-message-handler.service.spec.ts b/apps/desktop/src/services/biometric-message-handler.service.spec.ts index cc82c165219..0e92e3839fe 100644 --- a/apps/desktop/src/services/biometric-message-handler.service.spec.ts +++ b/apps/desktop/src/services/biometric-message-handler.service.spec.ts @@ -5,8 +5,8 @@ import { of } from "rxjs"; import { AccountInfo, AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/desktop/src/services/biometric-message-handler.service.ts b/apps/desktop/src/services/biometric-message-handler.service.ts index 7f4adce29d9..48026bca388 100644 --- a/apps/desktop/src/services/biometric-message-handler.service.ts +++ b/apps/desktop/src/services/biometric-message-handler.service.ts @@ -4,8 +4,8 @@ import { combineLatest, concatMap, firstValueFrom, map } from "rxjs"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; diff --git a/apps/desktop/src/services/duckduckgo-message-handler.service.ts b/apps/desktop/src/services/duckduckgo-message-handler.service.ts index e4474b60741..e82444be993 100644 --- a/apps/desktop/src/services/duckduckgo-message-handler.service.ts +++ b/apps/desktop/src/services/duckduckgo-message-handler.service.ts @@ -4,8 +4,8 @@ import { Injectable } from "@angular/core"; import { firstValueFrom } from "rxjs"; import { NativeMessagingVersion } from "@bitwarden/common/enums"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/web/src/app/auth/core/services/link-sso.service.spec.ts b/apps/web/src/app/auth/core/services/link-sso.service.spec.ts index 70b52999875..a9f2a50ba57 100644 --- a/apps/web/src/app/auth/core/services/link-sso.service.spec.ts +++ b/apps/web/src/app/auth/core/services/link-sso.service.spec.ts @@ -4,7 +4,7 @@ import { BehaviorSubject } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { SsoPreValidateResponse } from "@bitwarden/common/auth/models/response/sso-pre-validate.response"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/web/src/app/auth/core/services/link-sso.service.ts b/apps/web/src/app/auth/core/services/link-sso.service.ts index 3d51525add1..41de783efa2 100644 --- a/apps/web/src/app/auth/core/services/link-sso.service.ts +++ b/apps/web/src/app/auth/core/services/link-sso.service.ts @@ -2,7 +2,7 @@ import { firstValueFrom } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/apps/web/src/app/auth/core/services/login/web-login-component.service.spec.ts b/apps/web/src/app/auth/core/services/login/web-login-component.service.spec.ts index 57ea5e8ee05..95ddc74c3c5 100644 --- a/apps/web/src/app/auth/core/services/login/web-login-component.service.spec.ts +++ b/apps/web/src/app/auth/core/services/login/web-login-component.service.spec.ts @@ -10,7 +10,7 @@ import { Policy } from "@bitwarden/common/admin-console/models/domain/policy"; import { ResetPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/reset-password-policy-options"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/apps/web/src/app/auth/core/services/login/web-login-component.service.ts b/apps/web/src/app/auth/core/services/login/web-login-component.service.ts index 8d4c3bd84f0..c644f26dd90 100644 --- a/apps/web/src/app/auth/core/services/login/web-login-component.service.ts +++ b/apps/web/src/app/auth/core/services/login/web-login-component.service.ts @@ -15,7 +15,7 @@ import { Policy } from "@bitwarden/common/admin-console/models/domain/policy"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index 1fa4fd80e52..06a91895eb8 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -54,6 +54,7 @@ import { MasterPasswordApiService } from "@bitwarden/common/auth/abstractions/ma import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { @@ -61,7 +62,6 @@ import { VaultTimeoutStringType, } from "@bitwarden/common/key-management/vault-timeout"; import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService, Urls, diff --git a/apps/web/src/app/tools/send/send-access/access.component.ts b/apps/web/src/app/tools/send/send-access/access.component.ts index 6bed32e97d5..7fd66a10c20 100644 --- a/apps/web/src/app/tools/send/send-access/access.component.ts +++ b/apps/web/src/app/tools/send/send-access/access.component.ts @@ -5,8 +5,8 @@ import { FormBuilder } from "@angular/forms"; import { ActivatedRoute } from "@angular/router"; import { AnonLayoutWrapperDataService } from "@bitwarden/auth/angular"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts index 01e6ff69be9..98db7e08afc 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts @@ -10,9 +10,9 @@ import { OrganizationDomainResponse } from "@bitwarden/common/admin-console/abst import { OrganizationDomainRequest } from "@bitwarden/common/admin-console/services/organization-domain/requests/organization-domain.request"; import { HttpStatusCode } from "@bitwarden/common/enums"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; diff --git a/libs/angular/src/auth/components/sso.component.spec.ts b/libs/angular/src/auth/components/sso.component.spec.ts index 8b89031e731..0d28c6327b7 100644 --- a/libs/angular/src/auth/components/sso.component.spec.ts +++ b/libs/angular/src/auth/components/sso.component.spec.ts @@ -17,10 +17,10 @@ import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/ import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; import { AuthResult } from "@bitwarden/common/auth/models/domain/auth-result"; import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { FakeMasterPasswordService } from "@bitwarden/common/key-management/master-password/services/fake-master-password.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; diff --git a/libs/angular/src/auth/components/sso.component.ts b/libs/angular/src/auth/components/sso.component.ts index 24a619e28cf..eda5c06e0ab 100644 --- a/libs/angular/src/auth/components/sso.component.ts +++ b/libs/angular/src/auth/components/sso.component.ts @@ -18,9 +18,9 @@ import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/ import { AuthResult } from "@bitwarden/common/auth/models/domain/auth-result"; import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason"; import { SsoPreValidateResponse } from "@bitwarden/common/auth/models/response/sso-pre-validate.response"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 42fca029ec5..2caad95811b 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -144,9 +144,11 @@ import { OrganizationBillingApiService } from "@bitwarden/common/billing/service import { OrganizationBillingService } from "@bitwarden/common/billing/services/organization-billing.service"; import { TaxService } from "@bitwarden/common/billing/services/tax.service"; import { BulkEncryptService } from "@bitwarden/common/key-management/crypto/abstractions/bulk-encrypt.service"; +import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { BulkEncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/bulk-encrypt.service.implementation"; import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/multithread-encrypt.service.implementation"; +import { WebCryptoFunctionService } from "@bitwarden/common/key-management/crypto/services/web-crypto-function.service"; import { DeviceTrustServiceAbstraction } from "@bitwarden/common/key-management/device-trust/abstractions/device-trust.service.abstraction"; import { DeviceTrustService } from "@bitwarden/common/key-management/device-trust/services/device-trust.service.implementation"; import { KeyConnectorService as KeyConnectorServiceAbstraction } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service"; @@ -166,7 +168,6 @@ import { AppIdService as AppIdServiceAbstraction } from "@bitwarden/common/platf import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; import { ConfigApiServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config-api.service.abstraction"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService, RegionConfig, @@ -219,7 +220,6 @@ import { StateService } from "@bitwarden/common/platform/services/state.service" import { StorageServiceProvider } from "@bitwarden/common/platform/services/storage-service.provider"; import { UserAutoUnlockKeyService } from "@bitwarden/common/platform/services/user-auto-unlock-key.service"; import { ValidationService } from "@bitwarden/common/platform/services/validation.service"; -import { WebCryptoFunctionService } from "@bitwarden/common/platform/services/web-crypto-function.service"; import { ActiveUserStateProvider, DerivedStateProvider, diff --git a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts index 8e79bd54f76..cb4b7bc4c8c 100644 --- a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts +++ b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts @@ -25,11 +25,11 @@ import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth import { LoginViaAuthRequestView } from "@bitwarden/common/auth/models/view/login-via-auth-request.view"; import { ClientType, HttpStatusCode } from "@bitwarden/common/enums"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { DeviceTrustServiceAbstraction } from "@bitwarden/common/key-management/device-trust/abstractions/device-trust.service.abstraction"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; diff --git a/libs/auth/src/angular/login/default-login-component.service.spec.ts b/libs/auth/src/angular/login/default-login-component.service.spec.ts index 28e0e3db479..5dc9de1cb9a 100644 --- a/libs/auth/src/angular/login/default-login-component.service.spec.ts +++ b/libs/auth/src/angular/login/default-login-component.service.spec.ts @@ -3,7 +3,7 @@ import { of } from "rxjs"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService, Environment, @@ -14,7 +14,7 @@ import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legac import { DefaultLoginComponentService } from "./default-login-component.service"; -jest.mock("@bitwarden/common/platform/abstractions/crypto-function.service"); +jest.mock("@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"); jest.mock("@bitwarden/common/platform/abstractions/environment.service"); jest.mock("@bitwarden/common/platform/abstractions/platform-utils.service"); jest.mock("@bitwarden/common/auth/abstractions/sso-login.service.abstraction"); diff --git a/libs/auth/src/angular/login/default-login-component.service.ts b/libs/auth/src/angular/login/default-login-component.service.ts index c70be33f9d4..7f98040d9c2 100644 --- a/libs/auth/src/angular/login/default-login-component.service.ts +++ b/libs/auth/src/angular/login/default-login-component.service.ts @@ -3,7 +3,7 @@ import { LoginComponentService } from "@bitwarden/auth/angular"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/libs/auth/src/angular/sso/sso.component.ts b/libs/auth/src/angular/sso/sso.component.ts index 5d3fd689dd6..311ebf174ef 100644 --- a/libs/auth/src/angular/sso/sso.component.ts +++ b/libs/auth/src/angular/sso/sso.component.ts @@ -25,11 +25,11 @@ import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/for import { SsoPreValidateResponse } from "@bitwarden/common/auth/models/response/sso-pre-validate.response"; import { ClientType, HttpStatusCode } from "@bitwarden/common/enums"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { ErrorResponse } from "@bitwarden/common/models/response/error.response"; import { ListResponse } from "@bitwarden/common/models/response/list.response"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; diff --git a/libs/auth/src/common/services/pin/pin.service.implementation.ts b/libs/auth/src/common/services/pin/pin.service.implementation.ts index 9ec5b405a98..31f0c5b0177 100644 --- a/libs/auth/src/common/services/pin/pin.service.implementation.ts +++ b/libs/auth/src/common/services/pin/pin.service.implementation.ts @@ -3,8 +3,8 @@ import { firstValueFrom, map } from "rxjs"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { EncString, EncryptedString } from "@bitwarden/common/platform/models/domain/enc-string"; diff --git a/libs/auth/src/common/services/pin/pin.service.spec.ts b/libs/auth/src/common/services/pin/pin.service.spec.ts index ebdc36219ef..e0b18c74bde 100644 --- a/libs/auth/src/common/services/pin/pin.service.spec.ts +++ b/libs/auth/src/common/services/pin/pin.service.spec.ts @@ -1,7 +1,7 @@ import { mock } from "jest-mock-extended"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.spec.ts b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.spec.ts index f1fe07a996f..614c593048d 100644 --- a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.spec.ts +++ b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.spec.ts @@ -1,6 +1,6 @@ import { mock, MockProxy } from "jest-mock-extended"; -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "../../../key-management/crypto/abstractions/crypto-function.service"; import { WebAuthnLoginPrfKeyService } from "./webauthn-login-prf-key.service"; diff --git a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts index 92cc03e7592..7c57d62c131 100644 --- a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts +++ b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts @@ -1,4 +1,4 @@ -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "../../../key-management/crypto/abstractions/crypto-function.service"; import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; import { PrfKey } from "../../../types/key"; import { WebAuthnLoginPrfKeyServiceAbstraction } from "../../abstractions/webauthn/webauthn-login-prf-key.service.abstraction"; diff --git a/libs/common/src/platform/abstractions/crypto-function.service.ts b/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts similarity index 91% rename from libs/common/src/platform/abstractions/crypto-function.service.ts rename to libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts index 56b0ee55afe..4b89dde7021 100644 --- a/libs/common/src/platform/abstractions/crypto-function.service.ts +++ b/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts @@ -1,6 +1,9 @@ -import { CsprngArray } from "../../types/csprng"; -import { CbcDecryptParameters, EcbDecryptParameters } from "../models/domain/decrypt-parameters"; -import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; +import { + CbcDecryptParameters, + EcbDecryptParameters, +} from "../../../platform/models/domain/decrypt-parameters"; +import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; +import { CsprngArray } from "../../../types/csprng"; export abstract class CryptoFunctionService { abstract pbkdf2( diff --git a/libs/common/src/key-management/crypto/services/bulk-encrypt.service.impementation.spec.ts b/libs/common/src/key-management/crypto/services/bulk-encrypt.service.impementation.spec.ts index 1c27524c937..bc77cfb410f 100644 --- a/libs/common/src/key-management/crypto/services/bulk-encrypt.service.impementation.spec.ts +++ b/libs/common/src/key-management/crypto/services/bulk-encrypt.service.impementation.spec.ts @@ -2,11 +2,11 @@ import { mock, MockProxy } from "jest-mock-extended"; import * as rxjs from "rxjs"; import { ServerConfig } from "../../../platform/abstractions/config/server-config"; -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; import { LogService } from "../../../platform/abstractions/log.service"; import { Decryptable } from "../../../platform/interfaces/decryptable.interface"; import { InitializerMetadata } from "../../../platform/interfaces/initializer-metadata.interface"; import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; +import { CryptoFunctionService } from "../abstractions/crypto-function.service"; import { buildSetConfigMessage } from "../types/worker-command.type"; import { BulkEncryptServiceImplementation } from "./bulk-encrypt.service.implementation"; diff --git a/libs/common/src/key-management/crypto/services/bulk-encrypt.service.implementation.ts b/libs/common/src/key-management/crypto/services/bulk-encrypt.service.implementation.ts index a5149c59265..c22944ba217 100644 --- a/libs/common/src/key-management/crypto/services/bulk-encrypt.service.implementation.ts +++ b/libs/common/src/key-management/crypto/services/bulk-encrypt.service.implementation.ts @@ -4,7 +4,7 @@ import { firstValueFrom, fromEvent, filter, map, takeUntil, defaultIfEmpty, Subj import { Jsonify } from "type-fest"; import { BulkEncryptService } from "@bitwarden/common/key-management/crypto/abstractions/bulk-encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { Decryptable } from "@bitwarden/common/platform/interfaces/decryptable.interface"; import { InitializerMetadata } from "@bitwarden/common/platform/interfaces/initializer-metadata.interface"; diff --git a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts index 901e42d8f89..d10061a2be8 100644 --- a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts +++ b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { EncryptionType, diff --git a/libs/common/src/key-management/crypto/services/encrypt.service.spec.ts b/libs/common/src/key-management/crypto/services/encrypt.service.spec.ts index 7b173ab3eb2..275fd266f84 100644 --- a/libs/common/src/key-management/crypto/services/encrypt.service.spec.ts +++ b/libs/common/src/key-management/crypto/services/encrypt.service.spec.ts @@ -1,6 +1,6 @@ import { mockReset, mock } from "jest-mock-extended"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { EncryptionType } from "@bitwarden/common/platform/enums"; import { Utils } from "@bitwarden/common/platform/misc/utils"; diff --git a/libs/common/src/key-management/crypto/services/encrypt.worker.ts b/libs/common/src/key-management/crypto/services/encrypt.worker.ts index a31a65eaffc..e5aeb06560b 100644 --- a/libs/common/src/key-management/crypto/services/encrypt.worker.ts +++ b/libs/common/src/key-management/crypto/services/encrypt.worker.ts @@ -9,7 +9,6 @@ import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-cr import { ConsoleLogService } from "../../../platform/services/console-log.service"; import { ContainerService } from "../../../platform/services/container.service"; import { getClassInitializer } from "../../../platform/services/cryptography/get-class-initializer"; -import { WebCryptoFunctionService } from "../../../platform/services/web-crypto-function.service"; import { DECRYPT_COMMAND, SET_CONFIG_COMMAND, @@ -17,6 +16,7 @@ import { } from "../types/worker-command.type"; import { EncryptServiceImplementation } from "./encrypt.service.implementation"; +import { WebCryptoFunctionService } from "./web-crypto-function.service"; const workerApi: Worker = self as any; diff --git a/libs/common/src/key-management/crypto/services/multithread-encrypt.service.implementation.spec.ts b/libs/common/src/key-management/crypto/services/multithread-encrypt.service.implementation.spec.ts index b46334f1470..bb966c32507 100644 --- a/libs/common/src/key-management/crypto/services/multithread-encrypt.service.implementation.spec.ts +++ b/libs/common/src/key-management/crypto/services/multithread-encrypt.service.implementation.spec.ts @@ -2,10 +2,10 @@ import { mock } from "jest-mock-extended"; import * as rxjs from "rxjs"; import { ServerConfig } from "../../../platform/abstractions/config/server-config"; -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; import { LogService } from "../../../platform/abstractions/log.service"; import { Decryptable } from "../../../platform/interfaces/decryptable.interface"; import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; +import { CryptoFunctionService } from "../abstractions/crypto-function.service"; import { buildSetConfigMessage } from "../types/worker-command.type"; import { EncryptServiceImplementation } from "./encrypt.service.implementation"; diff --git a/libs/common/src/platform/services/web-crypto-function.service.spec.ts b/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts similarity index 98% rename from libs/common/src/platform/services/web-crypto-function.service.spec.ts rename to libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts index 1929e6454ef..0037ba3391d 100644 --- a/libs/common/src/platform/services/web-crypto-function.service.spec.ts +++ b/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts @@ -1,9 +1,9 @@ import { mock } from "jest-mock-extended"; -import { Utils } from "../../platform/misc/utils"; -import { PlatformUtilsService } from "../abstractions/platform-utils.service"; -import { EcbDecryptParameters } from "../models/domain/decrypt-parameters"; -import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; +import { PlatformUtilsService } from "../../../platform/abstractions/platform-utils.service"; +import { Utils } from "../../../platform/misc/utils"; +import { EcbDecryptParameters } from "../../../platform/models/domain/decrypt-parameters"; +import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; import { WebCryptoFunctionService } from "./web-crypto-function.service"; diff --git a/libs/common/src/platform/services/web-crypto-function.service.ts b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts similarity index 97% rename from libs/common/src/platform/services/web-crypto-function.service.ts rename to libs/common/src/key-management/crypto/services/web-crypto-function.service.ts index 61edf7a13b1..0c80d508b2d 100644 --- a/libs/common/src/platform/services/web-crypto-function.service.ts +++ b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts @@ -1,11 +1,14 @@ import * as argon2 from "argon2-browser"; import * as forge from "node-forge"; -import { Utils } from "../../platform/misc/utils"; -import { CsprngArray } from "../../types/csprng"; +import { Utils } from "../../../platform/misc/utils"; +import { + CbcDecryptParameters, + EcbDecryptParameters, +} from "../../../platform/models/domain/decrypt-parameters"; +import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; +import { CsprngArray } from "../../../types/csprng"; import { CryptoFunctionService } from "../abstractions/crypto-function.service"; -import { CbcDecryptParameters, EcbDecryptParameters } from "../models/domain/decrypt-parameters"; -import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; export class WebCryptoFunctionService implements CryptoFunctionService { private crypto: Crypto; diff --git a/libs/common/src/key-management/device-trust/services/device-trust.service.implementation.ts b/libs/common/src/key-management/device-trust/services/device-trust.service.implementation.ts index e681cc3e88c..bddcf6185f0 100644 --- a/libs/common/src/key-management/device-trust/services/device-trust.service.implementation.ts +++ b/libs/common/src/key-management/device-trust/services/device-trust.service.implementation.ts @@ -15,7 +15,6 @@ import { } from "../../../auth/models/request/update-devices-trust.request"; import { AppIdService } from "../../../platform/abstractions/app-id.service"; import { ConfigService } from "../../../platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; import { I18nService } from "../../../platform/abstractions/i18n.service"; import { KeyGenerationService } from "../../../platform/abstractions/key-generation.service"; import { LogService } from "../../../platform/abstractions/log.service"; @@ -28,6 +27,7 @@ import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-cr import { DEVICE_TRUST_DISK_LOCAL, StateProvider, UserKeyDefinition } from "../../../platform/state"; import { UserId } from "../../../types/guid"; import { UserKey, DeviceKey } from "../../../types/key"; +import { CryptoFunctionService } from "../../crypto/abstractions/crypto-function.service"; import { EncryptService } from "../../crypto/abstractions/encrypt.service"; import { DeviceTrustServiceAbstraction } from "../abstractions/device-trust.service.abstraction"; diff --git a/libs/common/src/key-management/device-trust/services/device-trust.service.spec.ts b/libs/common/src/key-management/device-trust/services/device-trust.service.spec.ts index aab6114be3d..61c90c5b5ee 100644 --- a/libs/common/src/key-management/device-trust/services/device-trust.service.spec.ts +++ b/libs/common/src/key-management/device-trust/services/device-trust.service.spec.ts @@ -20,7 +20,6 @@ import { ProtectedDeviceResponse } from "../../../auth/models/response/protected import { DeviceType } from "../../../enums"; import { AppIdService } from "../../../platform/abstractions/app-id.service"; import { ConfigService } from "../../../platform/abstractions/config/config.service"; -import { CryptoFunctionService } from "../../../platform/abstractions/crypto-function.service"; import { I18nService } from "../../../platform/abstractions/i18n.service"; import { KeyGenerationService } from "../../../platform/abstractions/key-generation.service"; import { LogService } from "../../../platform/abstractions/log.service"; @@ -35,6 +34,7 @@ import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-cr import { CsprngArray } from "../../../types/csprng"; import { UserId } from "../../../types/guid"; import { DeviceKey, UserKey } from "../../../types/key"; +import { CryptoFunctionService } from "../../crypto/abstractions/crypto-function.service"; import { EncryptService } from "../../crypto/abstractions/encrypt.service"; import { diff --git a/libs/common/src/platform/services/key-generation.service.spec.ts b/libs/common/src/platform/services/key-generation.service.spec.ts index 7bc547dac17..a2597414d0e 100644 --- a/libs/common/src/platform/services/key-generation.service.spec.ts +++ b/libs/common/src/platform/services/key-generation.service.spec.ts @@ -2,8 +2,8 @@ import { mock } from "jest-mock-extended"; import { PBKDF2KdfConfig, Argon2KdfConfig } from "@bitwarden/key-management"; +import { CryptoFunctionService } from "../../key-management/crypto/abstractions/crypto-function.service"; import { CsprngArray } from "../../types/csprng"; -import { CryptoFunctionService } from "../abstractions/crypto-function.service"; import { KeyGenerationService } from "./key-generation.service"; diff --git a/libs/common/src/platform/services/key-generation.service.ts b/libs/common/src/platform/services/key-generation.service.ts index 8b8ba6cb355..6203eaabdd1 100644 --- a/libs/common/src/platform/services/key-generation.service.ts +++ b/libs/common/src/platform/services/key-generation.service.ts @@ -2,8 +2,8 @@ // @ts-strict-ignore import { KdfConfig, PBKDF2KdfConfig, Argon2KdfConfig, KdfType } from "@bitwarden/key-management"; +import { CryptoFunctionService } from "../../key-management/crypto/abstractions/crypto-function.service"; import { CsprngArray } from "../../types/csprng"; -import { CryptoFunctionService } from "../abstractions/crypto-function.service"; import { KeyGenerationService as KeyGenerationServiceAbstraction } from "../abstractions/key-generation.service"; import { Utils } from "../misc/utils"; import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; diff --git a/libs/common/src/services/audit.service.ts b/libs/common/src/services/audit.service.ts index 60486cef0a8..10654267687 100644 --- a/libs/common/src/services/audit.service.ts +++ b/libs/common/src/services/audit.service.ts @@ -1,8 +1,8 @@ import { ApiService } from "../abstractions/api.service"; import { AuditService as AuditServiceAbstraction } from "../abstractions/audit.service"; +import { CryptoFunctionService } from "../key-management/crypto/abstractions/crypto-function.service"; import { BreachAccountResponse } from "../models/response/breach-account.response"; import { ErrorResponse } from "../models/response/error.response"; -import { CryptoFunctionService } from "../platform/abstractions/crypto-function.service"; import { throttle } from "../platform/misc/throttle"; import { Utils } from "../platform/misc/utils"; diff --git a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts index 62826ae3fe9..24523214dda 100644 --- a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts +++ b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts @@ -5,9 +5,9 @@ import { OidcClient } from "oidc-client-ts"; import { Subject, firstValueFrom } from "rxjs"; import { ClientType } from "@bitwarden/common/enums"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service"; import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts b/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts index 4cf81505184..168d76e2c70 100644 --- a/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts +++ b/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts @@ -1,4 +1,4 @@ -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; export class CryptoUtils { diff --git a/libs/importer/src/importers/lastpass/access/services/parser.ts b/libs/importer/src/importers/lastpass/access/services/parser.ts index 510dbc0a09b..427ae3441c1 100644 --- a/libs/importer/src/importers/lastpass/access/services/parser.ts +++ b/libs/importer/src/importers/lastpass/access/services/parser.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { Account, Chunk, ParserOptions, SharedFolder } from "../models"; diff --git a/libs/importer/src/importers/lastpass/access/vault.ts b/libs/importer/src/importers/lastpass/access/vault.ts index 832059d7843..cc54b3f2620 100644 --- a/libs/importer/src/importers/lastpass/access/vault.ts +++ b/libs/importer/src/importers/lastpass/access/vault.ts @@ -4,7 +4,7 @@ import * as papa from "papaparse"; import { decodeJwtTokenToJson } from "@bitwarden/auth/common"; import { HttpStatusCode } from "@bitwarden/common/enums"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { IdpProvider } from "./enums"; diff --git a/libs/key-management/src/key.service.spec.ts b/libs/key-management/src/key.service.spec.ts index f3264be69de..049ff7411c3 100644 --- a/libs/key-management/src/key.service.spec.ts +++ b/libs/key-management/src/key.service.spec.ts @@ -3,11 +3,11 @@ import { BehaviorSubject, bufferCount, firstValueFrom, lastValueFrom, of, take, import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { EncryptedOrganizationKeyData } from "@bitwarden/common/admin-console/models/data/encrypted-organization-key.data"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { FakeMasterPasswordService } from "@bitwarden/common/key-management/master-password/services/fake-master-password.service"; import { VaultTimeoutStringType } from "@bitwarden/common/key-management/vault-timeout"; import { VAULT_TIMEOUT } from "@bitwarden/common/key-management/vault-timeout/services/vault-timeout-settings.state"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/libs/key-management/src/key.service.ts b/libs/key-management/src/key.service.ts index f6a1851c5a7..e4f07911661 100644 --- a/libs/key-management/src/key.service.ts +++ b/libs/key-management/src/key.service.ts @@ -17,11 +17,11 @@ import { ProfileOrganizationResponse } from "@bitwarden/common/admin-console/mod import { ProfileProviderOrganizationResponse } from "@bitwarden/common/admin-console/models/response/profile-provider-organization.response"; import { ProfileProviderResponse } from "@bitwarden/common/admin-console/models/response/profile-provider.response"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { VaultTimeoutStringType } from "@bitwarden/common/key-management/vault-timeout"; import { VAULT_TIMEOUT } from "@bitwarden/common/key-management/vault-timeout/services/vault-timeout-settings.state"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; diff --git a/libs/node/src/services/node-crypto-function.service.ts b/libs/node/src/services/node-crypto-function.service.ts index c06f18023b4..78d72d44104 100644 --- a/libs/node/src/services/node-crypto-function.service.ts +++ b/libs/node/src/services/node-crypto-function.service.ts @@ -2,7 +2,7 @@ import * as crypto from "crypto"; import * as forge from "node-forge"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CbcDecryptParameters, diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts b/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts index 719b78bf9e1..0a92f4f02d7 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts @@ -1,8 +1,8 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore import { PinServiceAbstraction } from "@bitwarden/auth/common"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts index 04d32b843bf..15791ae04fb 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts @@ -5,9 +5,9 @@ import { BehaviorSubject, of } from "rxjs"; import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AccountInfo, AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { CipherWithIdExport } from "@bitwarden/common/models/export/cipher-with-ids.export"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncryptedString, EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { UserId } from "@bitwarden/common/types/guid"; diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts index 1fcdb84d375..d253ae8d0b1 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts @@ -8,9 +8,9 @@ import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { CipherWithIdExport, FolderWithIdExport } from "@bitwarden/common/models/export"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/org-vault-export.service.ts b/libs/tools/export/vault-export/vault-export-core/src/services/org-vault-export.service.ts index 8f6494edb70..e4ed105d1ad 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/org-vault-export.service.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/org-vault-export.service.ts @@ -14,9 +14,9 @@ import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { CipherWithIdExport, CollectionWithIdExport } from "@bitwarden/common/models/export"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { OrganizationId } from "@bitwarden/common/types/guid"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/vault-export.service.spec.ts b/libs/tools/export/vault-export/vault-export-core/src/services/vault-export.service.spec.ts index 6adaa7de3ba..a90f0a3ed7b 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/vault-export.service.spec.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/vault-export.service.spec.ts @@ -4,9 +4,9 @@ import { BehaviorSubject, of } from "rxjs"; import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AccountInfo, AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { CryptoFunctionService } from "@bitwarden/common/key-management/crypto/abstractions/crypto-function.service"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { CipherWithIdExport } from "@bitwarden/common/models/export/cipher-with-ids.export"; -import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncryptedString, EncString } from "@bitwarden/common/platform/models/domain/enc-string"; import { UserId } from "@bitwarden/common/types/guid"; From eea0bb6d6ebc83eef4e3b397f89ffa06cd9b0d2c Mon Sep 17 00:00:00 2001 From: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com> Date: Thu, 10 Apr 2025 10:06:23 -0400 Subject: [PATCH 06/16] [PM-18870] Convert Organization to Business Unit (#14131) * Add setupBusinessUnit to OrganizationBillingApiService * Add setup-business-unit.component * Updated designs and cleanup work * Update existing logos for Provider Portal and Admin Console * Fix broken test --- .../admin-console/icons/admin-console-logo.ts | 24 +++- .../icons/business-unit-portal-logo.icon.ts | 33 +++++ .../icons/provider-portal-logo.ts | 26 +++- .../services/billing-notification.service.ts | 8 ++ .../shared/product-switcher.service.ts | 8 +- apps/web/src/locales/en/messages.json | 9 ++ .../providers/providers-layout.component.html | 8 +- .../providers/providers-layout.component.ts | 25 +++- .../providers/providers-routing.module.ts | 6 + .../providers/providers.module.ts | 2 + .../clients/manage-clients.component.html | 6 +- .../clients/manage-clients.component.ts | 15 ++- .../setup/setup-business-unit.component.html | 25 ++++ .../setup/setup-business-unit.component.ts | 118 ++++++++++++++++++ .../provider-subscription-status.component.ts | 16 ++- .../admin-console/enums/provider-type.enum.ts | 2 +- .../models/data/provider.data.ts | 9 +- .../models/domain/organization.ts | 3 +- .../admin-console/models/domain/provider.ts | 9 +- .../response/profile-provider.response.ts | 9 +- .../services/provider.service.spec.ts | 8 +- ...ization-billing-api.service.abstraction.ts | 18 ++- .../organization-billing-api.service.ts | 20 +++ 23 files changed, 380 insertions(+), 27 deletions(-) create mode 100644 apps/web/src/app/admin-console/icons/business-unit-portal-logo.icon.ts create mode 100644 bitwarden_license/bit-web/src/app/billing/providers/setup/setup-business-unit.component.html create mode 100644 bitwarden_license/bit-web/src/app/billing/providers/setup/setup-business-unit.component.ts diff --git a/apps/web/src/app/admin-console/icons/admin-console-logo.ts b/apps/web/src/app/admin-console/icons/admin-console-logo.ts index 32b2b7a13a5..25b463217eb 100644 --- a/apps/web/src/app/admin-console/icons/admin-console-logo.ts +++ b/apps/web/src/app/admin-console/icons/admin-console-logo.ts @@ -1,5 +1,27 @@ import { svgIcon } from "@bitwarden/components"; export const AdminConsoleLogo = svgIcon` - + + + + + + + + + + + + + + + + + + + + + + + `; diff --git a/apps/web/src/app/admin-console/icons/business-unit-portal-logo.icon.ts b/apps/web/src/app/admin-console/icons/business-unit-portal-logo.icon.ts new file mode 100644 index 00000000000..f913ee68ef0 --- /dev/null +++ b/apps/web/src/app/admin-console/icons/business-unit-portal-logo.icon.ts @@ -0,0 +1,33 @@ +import { svgIcon } from "@bitwarden/components"; + +export const BusinessUnitPortalLogo = svgIcon` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; diff --git a/apps/web/src/app/admin-console/icons/provider-portal-logo.ts b/apps/web/src/app/admin-console/icons/provider-portal-logo.ts index 16f7b05d671..bc77c3f7902 100644 --- a/apps/web/src/app/admin-console/icons/provider-portal-logo.ts +++ b/apps/web/src/app/admin-console/icons/provider-portal-logo.ts @@ -1,5 +1,29 @@ import { svgIcon } from "@bitwarden/components"; export const ProviderPortalLogo = svgIcon` - + + + + + + + + + + + + + + + + + + + + + + + + + `; diff --git a/apps/web/src/app/billing/services/billing-notification.service.ts b/apps/web/src/app/billing/services/billing-notification.service.ts index 6695e516ca8..155a5011ed4 100644 --- a/apps/web/src/app/billing/services/billing-notification.service.ts +++ b/apps/web/src/app/billing/services/billing-notification.service.ts @@ -32,4 +32,12 @@ export class BillingNotificationService { message: message, }); } + + showError(message: string, title: string = "") { + this.toastService.showToast({ + variant: "error", + title, + message, + }); + } } diff --git a/apps/web/src/app/layouts/product-switcher/shared/product-switcher.service.ts b/apps/web/src/app/layouts/product-switcher/shared/product-switcher.service.ts index 1cc5c92c120..ec0d2c2651c 100644 --- a/apps/web/src/app/layouts/product-switcher/shared/product-switcher.service.ts +++ b/apps/web/src/app/layouts/product-switcher/shared/product-switcher.service.ts @@ -19,6 +19,7 @@ import { OrganizationService, } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; +import { ProviderType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -153,6 +154,11 @@ export class ProductSwitcherService { // TODO: This should be migrated to an Observable provided by the provider service and moved to the combineLatest above. See AC-2092. const providers = await this.providerService.getAll(); + const providerPortalName = + providers[0]?.providerType === ProviderType.BusinessUnit + ? "Business Unit Portal" + : "Provider Portal"; + const orgsMarketingRoute = this.platformUtilsService.isSelfHost() ? { route: "https://bitwarden.com/products/business/", @@ -201,7 +207,7 @@ export class ProductSwitcherService { isActive: this.router.url.includes("/organizations/"), }, provider: { - name: "Provider Portal", + name: providerPortalName, icon: "bwi-provider", appRoute: ["/providers", providers[0]?.id], isActive: this.router.url.includes("/providers/"), diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 3b63921935a..8fe74a5a2d2 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -10616,5 +10616,14 @@ }, "cannotCreateCollection": { "message": "Free organizations may have up to 2 collections. Upgrade to a paid plan to add more collections." + }, + "businessUnit": { + "message": "Business Unit" + }, + "businessUnits": { + "message": "Business Units" + }, + "newBusinessUnit": { + "message": "New business unit" } } diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html index 1623fd34a3a..8266b20b306 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html @@ -1,10 +1,14 @@ - + (); protected provider$: Observable; + protected logo$: Observable; + protected isBillable: Observable; protected canAccessBilling$: Observable; + protected clientsTranslationKey$: Observable; + constructor( private route: ActivatedRoute, private providerService: ProviderService, @@ -42,16 +47,28 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy { takeUntil(this.destroy$), ); + this.logo$ = this.provider$.pipe( + map((provider) => + provider.providerType === ProviderType.BusinessUnit + ? BusinessUnitPortalLogo + : ProviderPortalLogo, + ), + ); + this.isBillable = this.provider$.pipe( map((provider) => provider?.providerStatus === ProviderStatusType.Billable), - takeUntil(this.destroy$), ); this.canAccessBilling$ = combineLatest([this.isBillable, this.provider$]).pipe( map( ([hasConsolidatedBilling, provider]) => hasConsolidatedBilling && provider.isProviderAdmin, ), - takeUntil(this.destroy$), + ); + + this.clientsTranslationKey$ = this.provider$.pipe( + map((provider) => + provider.providerType === ProviderType.BusinessUnit ? "businessUnits" : "clients", + ), ); } diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-routing.module.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-routing.module.ts index 00c944e69bb..9be09c295ae 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-routing.module.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-routing.module.ts @@ -13,6 +13,7 @@ import { hasConsolidatedBilling, ProviderBillingHistoryComponent, } from "../../billing/providers"; +import { SetupBusinessUnitComponent } from "../../billing/providers/setup/setup-business-unit.component"; import { ClientsComponent } from "./clients/clients.component"; import { CreateOrganizationComponent } from "./clients/create-organization.component"; @@ -49,6 +50,11 @@ const routes: Routes = [ component: SetupProviderComponent, data: { titleId: "setupProvider" }, }, + { + path: "setup-business-unit", + component: SetupBusinessUnitComponent, + data: { titleId: "setupProvider" }, + }, ], }, { diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts index b8fe60814a8..dd9baa99948 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts @@ -19,6 +19,7 @@ import { ProviderSubscriptionStatusComponent, } from "../../billing/providers"; import { AddExistingOrganizationDialogComponent } from "../../billing/providers/clients/add-existing-organization-dialog.component"; +import { SetupBusinessUnitComponent } from "../../billing/providers/setup/setup-business-unit.component"; import { AddOrganizationComponent } from "./clients/add-organization.component"; import { CreateOrganizationComponent } from "./clients/create-organization.component"; @@ -75,6 +76,7 @@ import { VerifyRecoverDeleteProviderComponent } from "./verify-recover-delete-pr ProviderSubscriptionStatusComponent, ProvidersComponent, VerifyRecoverDeleteProviderComponent, + SetupBusinessUnitComponent, ], providers: [WebProviderService], }) diff --git a/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.html b/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.html index f75c4f3d651..ffcda9fccfa 100644 --- a/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.html +++ b/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.html @@ -1,4 +1,4 @@ - + + +
+ diff --git a/bitwarden_license/bit-web/src/app/billing/providers/setup/setup-business-unit.component.ts b/bitwarden_license/bit-web/src/app/billing/providers/setup/setup-business-unit.component.ts new file mode 100644 index 00000000000..4c8d483a0c5 --- /dev/null +++ b/bitwarden_license/bit-web/src/app/billing/providers/setup/setup-business-unit.component.ts @@ -0,0 +1,118 @@ +import { Component } from "@angular/core"; +import { ActivatedRoute, Params, Router } from "@angular/router"; +import { firstValueFrom } from "rxjs"; +import { filter, map, switchMap } from "rxjs/operators"; + +import { BitwardenLogo } from "@bitwarden/auth/angular"; +import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; +import { OrganizationBillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/organizations/organization-billing-api.service.abstraction"; +import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; +import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { StateProvider } from "@bitwarden/common/platform/state"; +import { SyncService } from "@bitwarden/common/platform/sync"; +import { OrganizationId } from "@bitwarden/common/types/guid"; +import { ProviderKey } from "@bitwarden/common/types/key"; +import { KeyService } from "@bitwarden/key-management"; +import { BillingNotificationService } from "@bitwarden/web-vault/app/billing/services/billing-notification.service"; +import { BaseAcceptComponent } from "@bitwarden/web-vault/app/common/base.accept.component"; + +@Component({ + templateUrl: "./setup-business-unit.component.html", +}) +export class SetupBusinessUnitComponent extends BaseAcceptComponent { + protected bitwardenLogo = BitwardenLogo; + + failedMessage = "emergencyInviteAcceptFailed"; + failedShortMessage = "emergencyInviteAcceptFailedShort"; + requiredParameters = ["organizationId", "email", "token"]; + + constructor( + activatedRoute: ActivatedRoute, + authService: AuthService, + private billingNotificationService: BillingNotificationService, + private encryptService: EncryptService, + i18nService: I18nService, + private keyService: KeyService, + private organizationBillingApiService: OrganizationBillingApiServiceAbstraction, + platformUtilsService: PlatformUtilsService, + router: Router, + private stateProvider: StateProvider, + private syncService: SyncService, + ) { + super(router, platformUtilsService, i18nService, activatedRoute, authService); + } + + async authedHandler(queryParams: Params) { + await this.process(queryParams); + } + + async unauthedHandler(_: Params) {} + + async login() { + await this.router.navigate(["/login"], { queryParams: { email: this.email } }); + } + + process = async (queryParams: Params): Promise => { + const fail = async () => { + this.billingNotificationService.showError(this.i18nService.t(this.failedMessage)); + return await this.router.navigate(["/"]); + }; + + const organizationId = queryParams.organizationId as string; + const token = queryParams.token as string; + + if (!organizationId || !token) { + return await fail(); + } + + const activeUserId$ = this.stateProvider.activeUserId$.pipe( + filter((userId): userId is NonNullable => userId != null), + ); + + const organizationKey$ = activeUserId$.pipe( + switchMap((userId) => this.keyService.orgKeys$(userId)), + filter( + (organizationKeysById): organizationKeysById is NonNullable => + organizationKeysById != null && organizationId in organizationKeysById, + ), + map((organizationKeysById) => organizationKeysById[organizationId as OrganizationId]), + ); + + const [{ encryptedString: encryptedProviderKey }, providerKey] = + await this.keyService.makeOrgKey(); + + const organizationKey = await firstValueFrom(organizationKey$); + + const { encryptedString: encryptedOrganizationKey } = await this.encryptService.encrypt( + organizationKey.key, + providerKey, + ); + + if (!encryptedProviderKey || !encryptedOrganizationKey) { + return await fail(); + } + + const userId = await firstValueFrom(activeUserId$); + + const request = { + userId, + token, + providerKey: encryptedProviderKey, + organizationKey: encryptedOrganizationKey, + }; + + try { + const providerId = await this.organizationBillingApiService.setupBusinessUnit( + organizationId, + request, + ); + await this.syncService.fullSync(true); + this.billingNotificationService.showSuccess(this.i18nService.t("providerSetup")); + return await this.router.navigate(["/providers", providerId]); + } catch (error) { + this.billingNotificationService.handleError(error); + return false; + } + }; +} diff --git a/bitwarden_license/bit-web/src/app/billing/providers/subscription/provider-subscription-status.component.ts b/bitwarden_license/bit-web/src/app/billing/providers/subscription/provider-subscription-status.component.ts index 6cf0b21169b..c49509427b8 100644 --- a/bitwarden_license/bit-web/src/app/billing/providers/subscription/provider-subscription-status.component.ts +++ b/bitwarden_license/bit-web/src/app/billing/providers/subscription/provider-subscription-status.component.ts @@ -39,8 +39,8 @@ export class ProviderSubscriptionStatusComponent { switch (this.subscription.providerType) { case ProviderType.Msp: return "managedServiceProvider"; - case ProviderType.MultiOrganizationEnterprise: - return "multiOrganizationEnterprise"; + case ProviderType.BusinessUnit: + return "businessUnit"; } } @@ -72,6 +72,18 @@ export class ProviderSubscriptionStatusComponent { }, }; } + case "trialing": { + return { + status: { + label: defaultStatusLabel, + value: this.i18nService.t("trial"), + }, + date: { + label: nextChargeDateLabel, + value: this.subscription.currentPeriodEndDate, + }, + }; + } case "past_due": { const pastDueText = this.i18nService.t("pastDue"); const suspensionDate = this.datePipe.transform( diff --git a/libs/common/src/admin-console/enums/provider-type.enum.ts b/libs/common/src/admin-console/enums/provider-type.enum.ts index d802c659f6f..eb48e362e7d 100644 --- a/libs/common/src/admin-console/enums/provider-type.enum.ts +++ b/libs/common/src/admin-console/enums/provider-type.enum.ts @@ -1,5 +1,5 @@ export enum ProviderType { Msp = 0, Reseller = 1, - MultiOrganizationEnterprise = 2, + BusinessUnit = 2, } diff --git a/libs/common/src/admin-console/models/data/provider.data.ts b/libs/common/src/admin-console/models/data/provider.data.ts index ff060ae2704..076c628db3e 100644 --- a/libs/common/src/admin-console/models/data/provider.data.ts +++ b/libs/common/src/admin-console/models/data/provider.data.ts @@ -1,4 +1,9 @@ -import { ProviderStatusType, ProviderUserStatusType, ProviderUserType } from "../../enums"; +import { + ProviderStatusType, + ProviderType, + ProviderUserStatusType, + ProviderUserType, +} from "../../enums"; import { ProfileProviderResponse } from "../response/profile-provider.response"; export class ProviderData { @@ -10,6 +15,7 @@ export class ProviderData { userId: string; useEvents: boolean; providerStatus: ProviderStatusType; + providerType: ProviderType; constructor(response: ProfileProviderResponse) { this.id = response.id; @@ -20,5 +26,6 @@ export class ProviderData { this.userId = response.userId; this.useEvents = response.useEvents; this.providerStatus = response.providerStatus; + this.providerType = response.providerType; } } diff --git a/libs/common/src/admin-console/models/domain/organization.ts b/libs/common/src/admin-console/models/domain/organization.ts index 6f7ff561f04..c5c5b53cce7 100644 --- a/libs/common/src/admin-console/models/domain/organization.ts +++ b/libs/common/src/admin-console/models/domain/organization.ts @@ -331,8 +331,7 @@ export class Organization { get hasBillableProvider() { return ( this.hasProvider && - (this.providerType === ProviderType.Msp || - this.providerType === ProviderType.MultiOrganizationEnterprise) + (this.providerType === ProviderType.Msp || this.providerType === ProviderType.BusinessUnit) ); } diff --git a/libs/common/src/admin-console/models/domain/provider.ts b/libs/common/src/admin-console/models/domain/provider.ts index a70cb72995a..d081644887c 100644 --- a/libs/common/src/admin-console/models/domain/provider.ts +++ b/libs/common/src/admin-console/models/domain/provider.ts @@ -1,6 +1,11 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { ProviderStatusType, ProviderUserStatusType, ProviderUserType } from "../../enums"; +import { + ProviderStatusType, + ProviderType, + ProviderUserStatusType, + ProviderUserType, +} from "../../enums"; import { ProviderData } from "../data/provider.data"; export class Provider { @@ -12,6 +17,7 @@ export class Provider { userId: string; useEvents: boolean; providerStatus: ProviderStatusType; + providerType: ProviderType; constructor(obj?: ProviderData) { if (obj == null) { @@ -26,6 +32,7 @@ export class Provider { this.userId = obj.userId; this.useEvents = obj.useEvents; this.providerStatus = obj.providerStatus; + this.providerType = obj.providerType; } get canAccess() { diff --git a/libs/common/src/admin-console/models/response/profile-provider.response.ts b/libs/common/src/admin-console/models/response/profile-provider.response.ts index 701fe843de8..ce35b064d52 100644 --- a/libs/common/src/admin-console/models/response/profile-provider.response.ts +++ b/libs/common/src/admin-console/models/response/profile-provider.response.ts @@ -1,5 +1,10 @@ import { BaseResponse } from "../../../models/response/base.response"; -import { ProviderStatusType, ProviderUserStatusType, ProviderUserType } from "../../enums"; +import { + ProviderStatusType, + ProviderType, + ProviderUserStatusType, + ProviderUserType, +} from "../../enums"; import { PermissionsApi } from "../api/permissions.api"; export class ProfileProviderResponse extends BaseResponse { @@ -13,6 +18,7 @@ export class ProfileProviderResponse extends BaseResponse { userId: string; useEvents: boolean; providerStatus: ProviderStatusType; + providerType: ProviderType; constructor(response: any) { super(response); @@ -26,5 +32,6 @@ export class ProfileProviderResponse extends BaseResponse { this.userId = this.getResponseProperty("UserId"); this.useEvents = this.getResponseProperty("UseEvents"); this.providerStatus = this.getResponseProperty("ProviderStatus"); + this.providerType = this.getResponseProperty("ProviderType"); } } diff --git a/libs/common/src/admin-console/services/provider.service.spec.ts b/libs/common/src/admin-console/services/provider.service.spec.ts index 0f4414804b8..92d5ae2e801 100644 --- a/libs/common/src/admin-console/services/provider.service.spec.ts +++ b/libs/common/src/admin-console/services/provider.service.spec.ts @@ -4,7 +4,12 @@ import { FakeAccountService, FakeStateProvider, mockAccountServiceWith } from ". import { FakeActiveUserState, FakeSingleUserState } from "../../../spec/fake-state"; import { Utils } from "../../platform/misc/utils"; import { UserId } from "../../types/guid"; -import { ProviderStatusType, ProviderUserStatusType, ProviderUserType } from "../enums"; +import { + ProviderStatusType, + ProviderType, + ProviderUserStatusType, + ProviderUserType, +} from "../enums"; import { ProviderData } from "../models/data/provider.data"; import { Provider } from "../models/domain/provider"; @@ -67,6 +72,7 @@ describe("PROVIDERS key definition", () => { userId: "string", useEvents: true, providerStatus: ProviderStatusType.Pending, + providerType: ProviderType.Msp, }, }; const result = sut.deserializer(JSON.parse(JSON.stringify(expectedResult))); diff --git a/libs/common/src/billing/abstractions/organizations/organization-billing-api.service.abstraction.ts b/libs/common/src/billing/abstractions/organizations/organization-billing-api.service.abstraction.ts index 2ed25491049..e1f7ad49012 100644 --- a/libs/common/src/billing/abstractions/organizations/organization-billing-api.service.abstraction.ts +++ b/libs/common/src/billing/abstractions/organizations/organization-billing-api.service.abstraction.ts @@ -1,19 +1,27 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { BillingInvoiceResponse, BillingTransactionResponse, } from "../../models/response/billing.response"; -export class OrganizationBillingApiServiceAbstraction { - getBillingInvoices: ( +export abstract class OrganizationBillingApiServiceAbstraction { + abstract getBillingInvoices: ( id: string, status?: string, startAfter?: string, ) => Promise; - getBillingTransactions: ( + abstract getBillingTransactions: ( id: string, startAfter?: string, ) => Promise; + + abstract setupBusinessUnit: ( + id: string, + request: { + userId: string; + token: string; + providerKey: string; + organizationKey: string; + }, + ) => Promise; } diff --git a/libs/common/src/billing/services/organization/organization-billing-api.service.ts b/libs/common/src/billing/services/organization/organization-billing-api.service.ts index 9bf1e6ee6d9..405bd41957f 100644 --- a/libs/common/src/billing/services/organization/organization-billing-api.service.ts +++ b/libs/common/src/billing/services/organization/organization-billing-api.service.ts @@ -49,4 +49,24 @@ export class OrganizationBillingApiService implements OrganizationBillingApiServ ); return r?.map((i: any) => new BillingTransactionResponse(i)) || []; } + + async setupBusinessUnit( + id: string, + request: { + userId: string; + token: string; + providerKey: string; + organizationKey: string; + }, + ): Promise { + const response = await this.apiService.send( + "POST", + `/organizations/${id}/billing/setup-business-unit`, + request, + true, + true, + ); + + return response as string; + } } From 63a3cb01600d11952bc2d1605a4fe449154cc835 Mon Sep 17 00:00:00 2001 From: Vicki League Date: Thu, 10 Apr 2025 11:51:43 -0400 Subject: [PATCH 07/16] [CL-394] Only run Chromatic action on relevant PRs (#14065) --- .github/workflows/chromatic.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 75a07431942..f436f1b3760 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -28,9 +28,22 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 + + - name: Get changed files + id: get-changed-files-for-chromatic + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + with: + filters: | + storyFiles: + - "apps/!(cli)/**" + - "bitwarden_license/bit-web/src/app/**" + - "libs/!(eslint)/**" + - "package.json" + - ".storybook/**" - name: Get Node version id: retrieve-node-version + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' run: | NODE_NVMRC=$(cat .nvmrc) NODE_VERSION=${NODE_NVMRC/v/''} @@ -40,6 +53,7 @@ jobs: uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 with: node-version: ${{ steps.retrieve-node-version.outputs.node_version }} + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - name: Cache NPM id: npm-cache @@ -47,12 +61,15 @@ jobs: with: path: "~/.npm" key: ${{ runner.os }}-npm-chromatic-${{ hashFiles('**/package-lock.json') }} + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - name: Install Node dependencies + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' run: npm ci # Manually build the Storybook to resolve a bug related to TurboSnap - name: Build Storybook + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' run: npm run build-storybook:ci - name: Publish to Chromatic @@ -64,3 +81,5 @@ jobs: exitOnceUploaded: true onlyChanged: true externals: "[\"libs/components/**/*.scss\", \"libs/components/**/*.css\", \"libs/components/tailwind.config*.js\"]" + # Rather than use an `if` check on the whole publish step, we need to tell Chromatic to skip so that any Chromatic-spawned actions are properly skipped + skip: ${{ steps.get-changed-files-for-chromatic.outputs.storyFiles == 'false' }} From 11e5bc61047355560b1f80058c5ef3d2b742ae6c Mon Sep 17 00:00:00 2001 From: Github Actions Date: Thu, 10 Apr 2025 17:27:43 +0000 Subject: [PATCH 08/16] Bumped Desktop client to 2025.4.1 --- apps/desktop/package.json | 2 +- apps/desktop/src/package-lock.json | 4 ++-- apps/desktop/src/package.json | 2 +- package-lock.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/desktop/package.json b/apps/desktop/package.json index a47d6fb88be..a4365b4c06a 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,7 +1,7 @@ { "name": "@bitwarden/desktop", "description": "A secure and free password manager for all of your devices.", - "version": "2025.4.0", + "version": "2025.4.1", "keywords": [ "bitwarden", "password", diff --git a/apps/desktop/src/package-lock.json b/apps/desktop/src/package-lock.json index 6c6a724560e..a720dff7257 100644 --- a/apps/desktop/src/package-lock.json +++ b/apps/desktop/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bitwarden/desktop", - "version": "2025.4.0", + "version": "2025.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bitwarden/desktop", - "version": "2025.4.0", + "version": "2025.4.1", "license": "GPL-3.0", "dependencies": { "@bitwarden/desktop-napi": "file:../desktop_native/napi" diff --git a/apps/desktop/src/package.json b/apps/desktop/src/package.json index b52172019f9..e288f5f5a79 100644 --- a/apps/desktop/src/package.json +++ b/apps/desktop/src/package.json @@ -2,7 +2,7 @@ "name": "@bitwarden/desktop", "productName": "Bitwarden", "description": "A secure and free password manager for all of your devices.", - "version": "2025.4.0", + "version": "2025.4.1", "author": "Bitwarden Inc. (https://bitwarden.com)", "homepage": "https://bitwarden.com", "license": "GPL-3.0", diff --git a/package-lock.json b/package-lock.json index c880e5f60d7..3cba61db6f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -230,7 +230,7 @@ }, "apps/desktop": { "name": "@bitwarden/desktop", - "version": "2025.4.0", + "version": "2025.4.1", "hasInstallScript": true, "license": "GPL-3.0" }, From c59b321dbb73b2e194cc61d648ebe37319def004 Mon Sep 17 00:00:00 2001 From: Bryan Cunningham Date: Thu, 10 Apr 2025 14:17:37 -0400 Subject: [PATCH 09/16] adds button story and docs for button with icon spacing (#14198) * add story & docs for button with icon spacing * add back block story removed in error * remove unnecessary args --- libs/components/src/button/button.mdx | 21 +++++++++++++++++++ libs/components/src/button/button.stories.ts | 22 ++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/libs/components/src/button/button.mdx b/libs/components/src/button/button.mdx index 21c992982d8..61874922fc7 100644 --- a/libs/components/src/button/button.mdx +++ b/libs/components/src/button/button.mdx @@ -73,6 +73,27 @@ where the width is fixed and the text wraps to 2 lines if exceeding the button +## With Icon + +To ensure consistent icon spacing, the icon should have .5rem spacing on left or right(depending on +placement). + +> NOTE: Use logical css properties to ensure LTR/RTL support. + +**If icon is placed before button label** + +```html + +``` + +**If icon is placed after button label** + +```html + +``` + + + ## Accessibility Please follow these guidelines to ensure that buttons are accessible to all users. diff --git a/libs/components/src/button/button.stories.ts b/libs/components/src/button/button.stories.ts index 6024b0559f2..448e290cce8 100644 --- a/libs/components/src/button/button.stories.ts +++ b/libs/components/src/button/button.stories.ts @@ -120,3 +120,25 @@ export const Block: Story = { block: true, }, }; + +export const WithIcon: Story = { + render: (args) => ({ + props: args, + template: ` + +
+ +
+
+ +
+
+ `, + }), +}; From d166cb96622576697f7355c7f50e0c6c22cba895 Mon Sep 17 00:00:00 2001 From: Vijay Oommen Date: Thu, 10 Apr 2025 13:18:07 -0500 Subject: [PATCH 10/16] PM-19470 Redirect to the first tab (#14164) --- .../critical-applications.component.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bitwarden_license/bit-web/src/app/tools/access-intelligence/critical-applications.component.ts b/bitwarden_license/bit-web/src/app/tools/access-intelligence/critical-applications.component.ts index ff5a4458a33..9e47a44b577 100644 --- a/bitwarden_license/bit-web/src/app/tools/access-intelligence/critical-applications.component.ts +++ b/bitwarden_license/bit-web/src/app/tools/access-intelligence/critical-applications.component.ts @@ -95,10 +95,13 @@ export class CriticalApplicationsComponent implements OnInit { } goToAllAppsTab = async () => { - await this.router.navigate([`organizations/${this.organizationId}/risk-insights`], { - queryParams: { tabIndex: RiskInsightsTabType.AllApps }, - queryParamsHandling: "merge", - }); + await this.router.navigate( + [`organizations/${this.organizationId}/access-intelligence/risk-insights`], + { + queryParams: { tabIndex: RiskInsightsTabType.AllApps }, + queryParamsHandling: "merge", + }, + ); }; unmarkAsCriticalApp = async (hostname: string) => { From f24a4d139d2c9496deb5e2a03489b740122380aa Mon Sep 17 00:00:00 2001 From: Bryan Cunningham Date: Thu, 10 Apr 2025 14:42:15 -0400 Subject: [PATCH 11/16] remove hint margin in radio button (#14223) --- libs/components/src/radio-button/radio-button.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/src/radio-button/radio-button.component.ts b/libs/components/src/radio-button/radio-button.component.ts index 042a54edf47..2db206bbaf9 100644 --- a/libs/components/src/radio-button/radio-button.component.ts +++ b/libs/components/src/radio-button/radio-button.component.ts @@ -16,7 +16,7 @@ let nextId = 0; export class RadioButtonComponent { @HostBinding("attr.id") @Input() id = `bit-radio-button-${nextId++}`; @HostBinding("class") get classList() { - return [this.block ? "tw-block" : "tw-inline-block", "tw-mb-1"]; + return [this.block ? "tw-block" : "tw-inline-block", "tw-mb-1", "[&_bit-hint]:tw-mt-0"]; } @Input() value: unknown; From 4772362928475de4165d86b8b0d00cd73838c83c Mon Sep 17 00:00:00 2001 From: Alec Rippberger <127791530+alec-livefront@users.noreply.github.com> Date: Thu, 10 Apr 2025 14:13:11 -0500 Subject: [PATCH 12/16] refactor(auth): [PM-8976] migrate two-factor setup component to Tailwind and standalone - Remove Bootstrap styles from two-factor-setup component and replace with Tailwind equivalents - Convert two factor components to standalone components to move away from LooseComponents - Replace ul/li list with bit-item-group and bit-item components - Integrate with the bit design system --------- Co-authored-by: Oscar Hinton Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> --- .../src/popup/images/two-factor/rc-w.png | Bin 3411 -> 0 bytes .../src/popup/images/two-factor/rc.png | Bin 3694 -> 0 bytes apps/browser/src/popup/scss/plugins.scss | 8 -- apps/desktop/src/images/two-factor/rc-w.png | Bin 3411 -> 0 bytes apps/desktop/src/images/two-factor/rc.png | Bin 3694 -> 0 bytes apps/desktop/src/scss/plugins.scss | 8 -- .../settings/organization-settings.module.ts | 3 + .../two-factor-recovery.component.ts | 40 +++++-- ...-factor-setup-authenticator.component.html | 2 +- ...wo-factor-setup-authenticator.component.ts | 30 ++++- .../two-factor-setup-duo.component.html | 4 +- .../two-factor-setup-duo.component.ts | 51 ++++++--- .../two-factor-setup-email.component.ts | 54 ++++++--- .../two-factor-setup-method-base.component.ts | 27 +++-- .../two-factor-setup-webauthn.component.html | 10 +- .../two-factor-setup-webauthn.component.ts | 76 +++++++++---- .../two-factor-setup-yubikey.component.html | 10 +- .../two-factor-setup-yubikey.component.ts | 106 ++++++++++++++---- .../two-factor-setup.component.html | 32 +++--- .../two-factor/two-factor-setup.component.ts | 7 +- .../two-factor/two-factor-verify.component.ts | 61 +++++++--- .../src/app/shared/loose-components.module.ts | 23 ---- apps/web/src/images/two-factor/rc-w.png | Bin 3411 -> 0 bytes apps/web/src/images/two-factor/rc.png | Bin 3694 -> 0 bytes apps/web/src/scss/plugins.scss | 14 --- .../src/menu/menu.component.spec.ts | 2 +- 26 files changed, 374 insertions(+), 194 deletions(-) delete mode 100644 apps/browser/src/popup/images/two-factor/rc-w.png delete mode 100644 apps/browser/src/popup/images/two-factor/rc.png delete mode 100644 apps/desktop/src/images/two-factor/rc-w.png delete mode 100644 apps/desktop/src/images/two-factor/rc.png delete mode 100644 apps/web/src/images/two-factor/rc-w.png delete mode 100644 apps/web/src/images/two-factor/rc.png diff --git a/apps/browser/src/popup/images/two-factor/rc-w.png b/apps/browser/src/popup/images/two-factor/rc-w.png deleted file mode 100644 index e83b8db13243687a7eb44e9c676f6c45ed54dc35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3411 zcmZuzc{tQ<_n$BfhQ>~oW<2IOP&R|4|b{(H#6=B@Yxao!4+ z%x0Nisx$Uj8@1PJdH`G+~6 z1rYL&uD#$Ikh!OEF90M1C;JEtVb1~K`v?U8r2XgJy}$qA4%kw10HdvJWR zxg*pg!{+9~Vw%RKSoT(u)OkkkMAY|Jr_Tw>ns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C4vK%-xl6iU-U6Y<=r=f8zX>u&p-yC`gpsFz=AuM$gDkR=y7M zG-Z&P-h$!XAJYS^+ZF#Cr{fRauqvn(ruF0QiPD$EDmlXU_$jP$HigChGH^2yGB(>(&go5irrEWG&-6+#dNL)S%Bq+rvHSVxN=Y*3X#*$uvU3EB?uimm{2lQfQi=W^}sM9x#d{cVLO+JNkcqwDSBh0fg z&f%aJG_lmA@)7*Ks5?k1hfpau=NuAVHQ`UqXHBU%3aV5*6P#7walHC@;ZBqat|A-Zz0~Ha=ds#z_#qK@&>~Rfq@%KJqH)* z3WR~97|)fYe&ZiTArnV@Y`#JDfLgCNAV_fuG6eJ8$@}IbNq2SWGSt0$*U^~+9bfon zEyoM$7{MqqV<&nx>Qse&hw($;MfbbjFeyVl6)SDLMQk)hXf=sIOCr@PgP4%;H>VN{ zxcnk9_VNa3Pm2Z9F62H&jXgKK&VThJ!8|u8f3{BPAn(*y7(He9t=Pu)Wp?M7?OLaq z+vnHM?w9zBX6Yfrp5gaZ&kv&tBR@%s44roL=JpL1I77Y*5rDF` z3x>1bt1tgrEe*rn_Phn9PIaqqn9&${mM0~p-aD+SQ~S(%6C!Vh^mc->f>BEwv)X2! z__g+W{_M9XkoBFkwC7Bjnd;_V?IOyKOQ9Q`hxzD)Q@c)XZmva6_f+hjjGl?<&|ccM Zm{ExN^XE!`#BhEW%uk&m6yjW?{tNL&o*e)H diff --git a/apps/browser/src/popup/scss/plugins.scss b/apps/browser/src/popup/scss/plugins.scss index b8ac8697b7f..591e8a1bd0c 100644 --- a/apps/browser/src/popup/scss/plugins.scss +++ b/apps/browser/src/popup/scss/plugins.scss @@ -21,11 +21,3 @@ max-width: 100px; } } - -.recovery-code-img { - @include themify($themes) { - content: url("../images/two-factor/rc" + themed("mfaLogoSuffix")); - max-width: 100px; - max-height: 45px; - } -} diff --git a/apps/desktop/src/images/two-factor/rc-w.png b/apps/desktop/src/images/two-factor/rc-w.png deleted file mode 100644 index e83b8db13243687a7eb44e9c676f6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{aMONaautZ zCoGal`BHps(XYk5l~6Rl)5$aQdEOR?xow6jFNb-&9^@H;2q|Y1GxUspZO4_iEK8LUAa;acY1EV*$;z!eMrYG%pO!Sct4-S7|MC`rD Nt;}uAYE3-}{|88xeg*&l diff --git a/apps/desktop/src/images/two-factor/rc.png b/apps/desktop/src/images/two-factor/rc.png deleted file mode 100644 index 4bebdf936ccfa8409d6bc74f7bc1a5ac4ec269f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3694 zcmai12T&91zYRSQN&+NwNsy+15JeG)5|T()Ab=u-1TczTiZnq`qy-5@45*ZgR}n)I zm8K#{5xD}P7eP7!q{x*fMT(TS(fj^0@6DTeXLiq?{r21M{LXK8W@qDU&X|e_$qIo$ zAQ5vj0ueZ}fV~jR1293O^cx7o_0z`6{uC%;59!L51~v*C&JleG*I{W&pA>lnL1rV! zBXBZX+GP;x%7&ANrCf%jNkdRzrpqwgWeDyvh#(CkNJ9wHfRyu)Byh>KL)wuIrF6iZ z2F0C+ppI;~Lk|epuzP^76lFw;GK`>%ASlDY`clAxoVZ3!r$Q$lnZD zbKFS-zajuUAWa^Y2Evkue@6!L{wp|P2Z1I4{HyE{AS_1!MFQd%11W%IIj#7QApN=o zME*UK^y^*{ClL^hlk0aBI?z{Ja*wUsc`efH&@Ny&(8;DYv19-Jjdr zw=+~yZZ5R9Csv7F$(dUHX(`GJ2@9MVmAP_GfX^VawJC14yDk3w^MTjCD_w?9=e%2nKU88k$kP|ErIuFeu4^DULbW}{5+_yg*eREFQZGIXzbnP#$auGZkR zBgE{xU|fWov)F~7OagyXQTOMPgHsdt(FQ`9A!p@|HY7|n52iwdk%w9OuN?S3H{0op zFlCzWq*)naR4~dbTo0y4;n8T;(fWA#01Y`l<*Q8=egPyNMH!vu(pV*kLM-*5_^AQV z;)gnxX0MkAD#W=eJ69K+&h;fIJsYWfGq`_Bp4Jo;X5pB+M>XVYa#Cu5i{L!+7{tHk zgeSd+6!&9dGy}Oy#~#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/plugins.scss +++ b/apps/desktop/src/scss/plugins.scss @@ -21,11 +21,3 @@ max-width: 100px; } } - -.recovery-code-img { - @include themify($themes) { - content: url("../images/two-factor/rc" + themed("mfaLogoSuffix")); - max-width: 100px; - max-height: 45px; - } -} diff --git a/apps/web/src/app/admin-console/organizations/settings/organization-settings.module.ts b/apps/web/src/app/admin-console/organizations/settings/organization-settings.module.ts index 2a2068d581f..bfff3b2aa2e 100644 --- a/apps/web/src/app/admin-console/organizations/settings/organization-settings.module.ts +++ b/apps/web/src/app/admin-console/organizations/settings/organization-settings.module.ts @@ -1,5 +1,7 @@ import { NgModule } from "@angular/core"; +import { ItemModule } from "@bitwarden/components"; + import { LooseComponentsModule, SharedModule } from "../../../shared"; import { AccountFingerprintComponent } from "../../../shared/components/account-fingerprint/account-fingerprint.component"; import { PoliciesModule } from "../../organizations/policies"; @@ -15,6 +17,7 @@ import { TwoFactorSetupComponent } from "./two-factor-setup.component"; PoliciesModule, OrganizationSettingsRoutingModule, AccountFingerprintComponent, + ItemModule, ], declarations: [AccountComponent, TwoFactorSetupComponent], }) diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-recovery.component.ts b/apps/web/src/app/auth/settings/two-factor/two-factor-recovery.component.ts index 19e01af4b0b..75a97661311 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-recovery.component.ts +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-recovery.component.ts @@ -1,36 +1,50 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore +import { CommonModule } from "@angular/common"; import { Component, Inject } from "@angular/core"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; import { TwoFactorRecoverResponse } from "@bitwarden/common/auth/models/response/two-factor-recover.response"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { DIALOG_DATA, DialogConfig, DialogService } from "@bitwarden/components"; +import { + ButtonModule, + DIALOG_DATA, + DialogConfig, + DialogModule, + DialogRef, + DialogService, + TypographyModule, +} from "@bitwarden/components"; +import { I18nPipe } from "@bitwarden/ui-common"; @Component({ selector: "app-two-factor-recovery", templateUrl: "two-factor-recovery.component.html", + standalone: true, + imports: [CommonModule, DialogModule, ButtonModule, TypographyModule, I18nPipe], }) export class TwoFactorRecoveryComponent { type = -1; - code: string; - authed: boolean; + code: string = ""; + authed: boolean = false; twoFactorProviderType = TwoFactorProviderType; constructor( - @Inject(DIALOG_DATA) protected data: any, + @Inject(DIALOG_DATA) protected data: { response: { response: TwoFactorRecoverResponse } }, private i18nService: I18nService, ) { this.auth(data.response); } - auth(authResponse: any) { + auth(authResponse: { response: TwoFactorRecoverResponse }) { this.authed = true; this.processResponse(authResponse.response); } print() { const w = window.open(); + if (!w) { + // return early if the window is not open + return; + } w.document.write( '
' + "

" + @@ -47,9 +61,9 @@ export class TwoFactorRecoveryComponent { w.print(); } - private formatString(s: string) { + private formatString(s: string): string { if (s == null) { - return null; + return ""; } return s .replace(/(.{4})/g, "$1 ") @@ -61,7 +75,13 @@ export class TwoFactorRecoveryComponent { this.code = this.formatString(response.code); } - static open(dialogService: DialogService, config: DialogConfig) { + static open( + dialogService: DialogService, + config: DialogConfig< + { response: { response: TwoFactorRecoverResponse } }, + DialogRef + >, + ) { return dialogService.open(TwoFactorRecoveryComponent, config); } } diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-authenticator.component.html b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-authenticator.component.html index a31d4c33458..1595c0350d0 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-authenticator.component.html +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-authenticator.component.html @@ -41,7 +41,7 @@ {{ "twoStepAuthenticatorInstructionSuffix" | i18n }}

-

+

- + {{ "twoStepLoginProviderEnabled" | i18n }} - + Duo logo {{ "twoFactorDuoClientId" | i18n }}: {{ clientId }}
diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-duo.component.ts b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-duo.component.ts index 833ce5c1cb8..bada3301a97 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-duo.component.ts +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-duo.component.ts @@ -1,7 +1,6 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore +import { CommonModule } from "@angular/common"; import { Component, EventEmitter, Inject, OnInit, Output } from "@angular/core"; -import { FormBuilder, Validators } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; @@ -13,18 +12,41 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { + AsyncActionsModule, + ButtonModule, + CalloutModule, DIALOG_DATA, DialogConfig, + DialogModule, DialogRef, DialogService, + FormFieldModule, + IconModule, + InputModule, ToastService, + TypographyModule, } from "@bitwarden/components"; +import { I18nPipe } from "@bitwarden/ui-common"; import { TwoFactorSetupMethodBaseComponent } from "./two-factor-setup-method-base.component"; @Component({ selector: "app-two-factor-setup-duo", templateUrl: "two-factor-setup-duo.component.html", + standalone: true, + imports: [ + CommonModule, + DialogModule, + FormFieldModule, + InputModule, + TypographyModule, + ButtonModule, + IconModule, + I18nPipe, + ReactiveFormsModule, + AsyncActionsModule, + CalloutModule, + ], }) export class TwoFactorSetupDuoComponent extends TwoFactorSetupMethodBaseComponent @@ -63,23 +85,23 @@ export class TwoFactorSetupDuoComponent ); } - get clientId() { - return this.formGroup.get("clientId").value; + get clientId(): string { + return this.formGroup.get("clientId")?.value || ""; } - get clientSecret() { - return this.formGroup.get("clientSecret").value; + get clientSecret(): string { + return this.formGroup.get("clientSecret")?.value || ""; } - get host() { - return this.formGroup.get("host").value; + get host(): string { + return this.formGroup.get("host")?.value || ""; } set clientId(value: string) { - this.formGroup.get("clientId").setValue(value); + this.formGroup.get("clientId")?.setValue(value); } set clientSecret(value: string) { - this.formGroup.get("clientSecret").setValue(value); + this.formGroup.get("clientSecret")?.setValue(value); } set host(value: string) { - this.formGroup.get("host").setValue(value); + this.formGroup.get("host")?.setValue(value); } async ngOnInit() { @@ -147,7 +169,10 @@ export class TwoFactorSetupDuoComponent dialogService: DialogService, config: DialogConfig, ) => { - return dialogService.open(TwoFactorSetupDuoComponent, config); + return dialogService.open( + TwoFactorSetupDuoComponent, + config as DialogConfig>, + ); }; } diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-email.component.ts b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-email.component.ts index 40f50a33937..c5692c3f080 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-email.component.ts +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-email.component.ts @@ -1,7 +1,6 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore +import { CommonModule } from "@angular/common"; import { Component, EventEmitter, Inject, OnInit, Output } from "@angular/core"; -import { FormBuilder, Validators } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; import { firstValueFrom, map } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; @@ -16,19 +15,41 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { + AsyncActionsModule, + ButtonModule, + CalloutModule, DIALOG_DATA, DialogConfig, + DialogModule, DialogRef, DialogService, + FormFieldModule, + IconModule, + InputModule, ToastService, + TypographyModule, } from "@bitwarden/components"; +import { I18nPipe } from "@bitwarden/ui-common"; import { TwoFactorSetupMethodBaseComponent } from "./two-factor-setup-method-base.component"; @Component({ selector: "app-two-factor-setup-email", templateUrl: "two-factor-setup-email.component.html", - outputs: ["onUpdated"], + standalone: true, + imports: [ + AsyncActionsModule, + ButtonModule, + CalloutModule, + CommonModule, + DialogModule, + FormFieldModule, + IconModule, + I18nPipe, + InputModule, + ReactiveFormsModule, + TypographyModule, + ], }) export class TwoFactorSetupEmailComponent extends TwoFactorSetupMethodBaseComponent @@ -36,8 +57,8 @@ export class TwoFactorSetupEmailComponent { @Output() onChangeStatus: EventEmitter = new EventEmitter(); type = TwoFactorProviderType.Email; - sentEmail: string; - emailPromise: Promise; + sentEmail: string = ""; + emailPromise: Promise | undefined; override componentName = "app-two-factor-email"; formGroup = this.formBuilder.group({ token: ["", [Validators.required]], @@ -67,17 +88,17 @@ export class TwoFactorSetupEmailComponent toastService, ); } - get token() { - return this.formGroup.get("token").value; + get token(): string { + return this.formGroup.get("token")?.value || ""; } - set token(value: string) { - this.formGroup.get("token").setValue(value); + set token(value: string | null) { + this.formGroup.get("token")?.setValue(value || ""); } - get email() { - return this.formGroup.get("email").value; + get email(): string { + return this.formGroup.get("email")?.value || ""; } - set email(value: string) { - this.formGroup.get("email").setValue(value); + set email(value: string | null | undefined) { + this.formGroup.get("email")?.setValue(value || ""); } async ngOnInit() { @@ -149,6 +170,9 @@ export class TwoFactorSetupEmailComponent dialogService: DialogService, config: DialogConfig>, ) { - return dialogService.open(TwoFactorSetupEmailComponent, config); + return dialogService.open>( + TwoFactorSetupEmailComponent, + config as DialogConfig, DialogRef>, + ); } } diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-method-base.component.ts b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-method-base.component.ts index b87b92a965c..0654ad126e2 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-method-base.component.ts +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-method-base.component.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { Directive, EventEmitter, Output } from "@angular/core"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; @@ -17,18 +15,20 @@ import { DialogService, ToastService } from "@bitwarden/components"; /** * Base class for two-factor setup components (ex: email, yubikey, webauthn, duo). */ -@Directive() +@Directive({ + standalone: true, +}) export abstract class TwoFactorSetupMethodBaseComponent { @Output() onUpdated = new EventEmitter(); - type: TwoFactorProviderType; - organizationId: string; + type: TwoFactorProviderType | undefined; + organizationId: string | null = null; twoFactorProviderType = TwoFactorProviderType; enabled = false; authed = false; - protected hashedSecret: string; - protected verificationType: VerificationType; + protected hashedSecret: string | undefined; + protected verificationType: VerificationType | undefined; protected componentName = ""; constructor( @@ -74,6 +74,9 @@ export abstract class TwoFactorSetupMethodBaseComponent { try { const request = await this.buildRequestModel(TwoFactorProviderRequest); + if (this.type === undefined) { + throw new Error("Two-factor provider type is required"); + } request.type = this.type; if (this.organizationId != null) { promise = this.apiService.putTwoFactorOrganizationDisable(this.organizationId, request); @@ -84,7 +87,7 @@ export abstract class TwoFactorSetupMethodBaseComponent { this.enabled = false; this.toastService.showToast({ variant: "success", - title: null, + title: "", message: this.i18nService.t("twoStepDisabled"), }); this.onUpdated.emit(false); @@ -105,6 +108,9 @@ export abstract class TwoFactorSetupMethodBaseComponent { } const request = await this.buildRequestModel(TwoFactorProviderRequest); + if (this.type === undefined) { + throw new Error("Two-factor provider type is required"); + } request.type = this.type; if (this.organizationId != null) { await this.apiService.putTwoFactorOrganizationDisable(this.organizationId, request); @@ -114,7 +120,7 @@ export abstract class TwoFactorSetupMethodBaseComponent { this.enabled = false; this.toastService.showToast({ variant: "success", - title: null, + title: "", message: this.i18nService.t("twoStepDisabled"), }); this.onUpdated.emit(false); @@ -123,6 +129,9 @@ export abstract class TwoFactorSetupMethodBaseComponent { protected async buildRequestModel( requestClass: new () => T, ) { + if (this.hashedSecret === undefined || this.verificationType === undefined) { + throw new Error("User verification data is missing"); + } return this.userVerificationService.buildRequest( { secret: this.hashedSecret, diff --git a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-webauthn.component.html b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-webauthn.component.html index 4d505161631..767934cf3da 100644 --- a/apps/web/src/app/auth/settings/two-factor/two-factor-setup-webauthn.component.html +++ b/apps/web/src/app/auth/settings/two-factor/two-factor-setup-webauthn.component.html @@ -5,23 +5,23 @@ [subtitle]="'webAuthnTitle' | i18n" > - {{ "twoStepLoginProviderEnabled" | i18n }} - - + +

{{ "twoFactorWebAuthnWarning1" | i18n }}

- + FIDO2 WebAuthn logo