diff --git a/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts b/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts index 4bacd453803..f17e2cbdf09 100644 --- a/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts +++ b/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts @@ -75,6 +75,7 @@ describe("AccountSwitcherService", () => { name: "Test User 1", email: "test1@email.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }; avatarService.getUserAvatarColor$.mockReturnValue(of("#cccccc")); @@ -113,6 +114,7 @@ describe("AccountSwitcherService", () => { email: `test${i}@email.com`, emailVerified: true, name: "Test User ${i}", + creationDate: "2024-01-01T00:00:00.000Z", }; seedStatuses[`${i}` as UserId] = AuthenticationStatus.Unlocked; } @@ -137,6 +139,7 @@ describe("AccountSwitcherService", () => { name: "Test User 1", email: "", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }; accountsSubject.next({ ["1" as UserId]: user1AccountInfo }); authStatusSubject.next({ ["1" as UserId]: AuthenticationStatus.LoggedOut }); diff --git a/apps/browser/src/autofill/background/notification.background.spec.ts b/apps/browser/src/autofill/background/notification.background.spec.ts index 8df21bc66ef..e2c6a985416 100644 --- a/apps/browser/src/autofill/background/notification.background.spec.ts +++ b/apps/browser/src/autofill/background/notification.background.spec.ts @@ -85,6 +85,7 @@ describe("NotificationBackground", () => { email: "test@example.com", emailVerified: true, name: "Test User", + creationDate: "2024-01-01T00:00:00.000Z", }); beforeEach(() => { 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 49d346bfa3a..52b24e92740 100644 --- a/apps/desktop/src/services/biometric-message-handler.service.spec.ts +++ b/apps/desktop/src/services/biometric-message-handler.service.spec.ts @@ -28,11 +28,13 @@ const accounts: Record = { name: "some user", email: "some.user@example.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }, [AnotherUser]: { name: "some other user", email: "some.other.user@example.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }, }; diff --git a/apps/web/src/app/vault/individual-vault/vault-banners/services/vault-banners.service.spec.ts b/apps/web/src/app/vault/individual-vault/vault-banners/services/vault-banners.service.spec.ts index 6b46cd89956..c91707a933e 100644 --- a/apps/web/src/app/vault/individual-vault/vault-banners/services/vault-banners.service.spec.ts +++ b/apps/web/src/app/vault/individual-vault/vault-banners/services/vault-banners.service.spec.ts @@ -28,7 +28,12 @@ describe("VaultBannersService", () => { const getEmailVerified = jest.fn().mockResolvedValue(true); const lastSync$ = new BehaviorSubject(null); const accounts$ = new BehaviorSubject>({ - [userId]: { email: "test@bitwarden.com", emailVerified: true, name: "name" } as AccountInfo, + [userId]: { + email: "test@bitwarden.com", + emailVerified: true, + name: "name", + creationDate: "2024-01-01T00:00:00.000Z", + } as AccountInfo, }); const pendingAuthRequests$ = new BehaviorSubject>([]); diff --git a/libs/angular/src/key-management/encrypted-migration/encrypted-migrations-scheduler.service.spec.ts b/libs/angular/src/key-management/encrypted-migration/encrypted-migrations-scheduler.service.spec.ts index 76cfbc0bfdd..1c43b4d90ce 100644 --- a/libs/angular/src/key-management/encrypted-migration/encrypted-migrations-scheduler.service.spec.ts +++ b/libs/angular/src/key-management/encrypted-migration/encrypted-migrations-scheduler.service.spec.ts @@ -27,11 +27,13 @@ const accounts: Record = { name: "some user", email: "some.user@example.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }, [AnotherUser]: { name: "some other user", email: "some.other.user@example.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }, }; diff --git a/libs/common/spec/fake-account-service.ts b/libs/common/spec/fake-account-service.ts index 389975dc2e1..450f7db715f 100644 --- a/libs/common/spec/fake-account-service.ts +++ b/libs/common/spec/fake-account-service.ts @@ -17,6 +17,7 @@ export function mockAccountServiceWith( name: "name", email: "email", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }, }; @@ -104,6 +105,10 @@ export class FakeAccountService implements AccountService { await this.mock.setAccountEmailVerified(userId, emailVerified); } + async setAccountCreationDate(userId: UserId, creationDate: string): Promise { + await this.mock.setAccountCreationDate(userId, creationDate); + } + async switchAccount(userId: UserId): Promise { const next = userId == null ? null : { id: userId, ...this.accountsSubject["_buffer"]?.[0]?.[userId] }; @@ -127,4 +132,5 @@ const loggedOutInfo: AccountInfo = { name: undefined, email: "", emailVerified: false, + creationDate: undefined, }; diff --git a/libs/common/src/auth/abstractions/account.service.ts b/libs/common/src/auth/abstractions/account.service.ts index a48cc8d1405..78822f3ebd5 100644 --- a/libs/common/src/auth/abstractions/account.service.ts +++ b/libs/common/src/auth/abstractions/account.service.ts @@ -77,7 +77,7 @@ export abstract class AccountService { * @param userId * @param creationDate */ - abstract setCreationDate(userId: UserId, creationDate: string): Promise; + abstract setAccountCreationDate(userId: UserId, creationDate: string): Promise; /** * updates the `accounts$` observable with the new VerifyNewDeviceLogin property for the account. * @param userId diff --git a/libs/common/src/auth/services/account.service.spec.ts b/libs/common/src/auth/services/account.service.spec.ts index 22d66045fc0..ebd97607c97 100644 --- a/libs/common/src/auth/services/account.service.spec.ts +++ b/libs/common/src/auth/services/account.service.spec.ts @@ -293,7 +293,7 @@ describe("accountService", () => { it("should update the account with a new creation date", async () => { const newCreationDate = "2024-12-31T00:00:00.000Z"; - await sut.setCreationDate(userId, newCreationDate); + await sut.setAccountCreationDate(userId, newCreationDate); const currentState = await firstValueFrom(accountsState.state$); expect(currentState).toEqual({ @@ -302,7 +302,7 @@ describe("accountService", () => { }); it("should not update if the creation date is the same", async () => { - await sut.setCreationDate(userId, userInfo.creationDate); + await sut.setAccountCreationDate(userId, userInfo.creationDate); const currentState = await firstValueFrom(accountsState.state$); expect(currentState).toEqual(initialState); @@ -316,7 +316,7 @@ describe("accountService", () => { accountsState.stateSubject.next({ [userId]: accountWithoutCreationDate }); const newCreationDate = "2024-06-15T12:30:00.000Z"; - await sut.setCreationDate(userId, newCreationDate); + await sut.setAccountCreationDate(userId, newCreationDate); const currentState = await firstValueFrom(accountsState.state$); expect(currentState).toEqual({ @@ -326,7 +326,7 @@ describe("accountService", () => { it("should update to a different creation date string format", async () => { const newCreationDate = "2023-03-15T08:45:30.123Z"; - await sut.setCreationDate(userId, newCreationDate); + await sut.setAccountCreationDate(userId, newCreationDate); const currentState = await firstValueFrom(accountsState.state$); expect(currentState).toEqual({ diff --git a/libs/common/src/auth/services/account.service.ts b/libs/common/src/auth/services/account.service.ts index 071c174e1f2..1b028d1eba9 100644 --- a/libs/common/src/auth/services/account.service.ts +++ b/libs/common/src/auth/services/account.service.ts @@ -168,7 +168,7 @@ export class AccountServiceImplementation implements InternalAccountService { await this.setAccountInfo(userId, { emailVerified }); } - async setCreationDate(userId: UserId, creationDate: string): Promise { + async setAccountCreationDate(userId: UserId, creationDate: string): Promise { await this.setAccountInfo(userId, { creationDate }); } diff --git a/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.spec.ts b/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.spec.ts index 0b12e1cb661..3c37a647074 100644 --- a/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.spec.ts +++ b/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.spec.ts @@ -53,9 +53,15 @@ describe("AuthRequestAnsweringService", () => { email: "user@example.com", emailVerified: true, name: "User", + creationDate: "2024-01-01T00:00:00.000Z", }); accountService.accounts$ = of({ - [userId]: { email: "user@example.com", emailVerified: true, name: "User" }, + [userId]: { + email: "user@example.com", + emailVerified: true, + name: "User", + creationDate: "2024-01-01T00:00:00.000Z", + }, }); (masterPasswordService.forceSetPasswordReason$ as jest.Mock).mockReturnValue( of(ForceSetPasswordReason.None), diff --git a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts index 7e6e0d53f57..feff83b3105 100644 --- a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts +++ b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts @@ -100,6 +100,7 @@ describe("PasswordResetEnrollmentServiceImplementation", () => { name: "Test User 1", email: "test1@email.com", emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", }; activeAccountSubject.next(Object.assign(user1AccountInfo, { id: "userId" as UserId })); diff --git a/libs/common/src/platform/server-notifications/internal/default-server-notifications.multiuser.spec.ts b/libs/common/src/platform/server-notifications/internal/default-server-notifications.multiuser.spec.ts index cd1bf97150c..91620764d18 100644 --- a/libs/common/src/platform/server-notifications/internal/default-server-notifications.multiuser.spec.ts +++ b/libs/common/src/platform/server-notifications/internal/default-server-notifications.multiuser.spec.ts @@ -174,7 +174,12 @@ describe("DefaultServerNotificationsService (multi-user)", () => { const currentAccounts = (userAccounts$.getValue() as Record) ?? {}; userAccounts$.next({ ...currentAccounts, - [userId]: { email: "email", name: "Test Name", emailVerified: true }, + [userId]: { + email: "email", + name: "Test Name", + emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", + }, } as any); } diff --git a/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.spec.ts b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.spec.ts index 4a9b0809ac9..535f93eaee3 100644 --- a/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.spec.ts +++ b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.spec.ts @@ -139,11 +139,22 @@ describe("NotificationsService", () => { activeAccount.next(null); accounts.next({} as any); } else { - activeAccount.next({ id: userId, email: "email", name: "Test Name", emailVerified: true }); + activeAccount.next({ + id: userId, + email: "email", + name: "Test Name", + emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", + }); const current = (accounts.getValue() as Record) ?? {}; accounts.next({ ...current, - [userId]: { email: "email", name: "Test Name", emailVerified: true }, + [userId]: { + email: "email", + name: "Test Name", + emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", + }, } as any); } } @@ -349,7 +360,13 @@ describe("NotificationsService", () => { describe("processNotification", () => { beforeEach(async () => { appIdService.getAppId.mockResolvedValue("test-app-id"); - activeAccount.next({ id: mockUser1, email: "email", name: "Test Name", emailVerified: true }); + activeAccount.next({ + id: mockUser1, + email: "email", + name: "Test Name", + emailVerified: true, + creationDate: "2024-01-01T00:00:00.000Z", + }); }); describe("NotificationType.LogOut", () => { diff --git a/libs/common/src/platform/services/sdk/default-sdk.service.spec.ts b/libs/common/src/platform/services/sdk/default-sdk.service.spec.ts index 1286ea7b7f9..8ec1b3a2ee9 100644 --- a/libs/common/src/platform/services/sdk/default-sdk.service.spec.ts +++ b/libs/common/src/platform/services/sdk/default-sdk.service.spec.ts @@ -92,7 +92,12 @@ describe("DefaultSdkService", () => { .calledWith(userId) .mockReturnValue(new BehaviorSubject(mock())); accountService.accounts$ = of({ - [userId]: { email: "email", emailVerified: true, name: "name" } as AccountInfo, + [userId]: { + email: "email", + emailVerified: true, + name: "name", + creationDate: "2024-01-01T00:00:00.000Z", + } as AccountInfo, }); kdfConfigService.getKdfConfig$ .calledWith(userId) diff --git a/libs/common/src/platform/services/sdk/register-sdk.service.spec.ts b/libs/common/src/platform/services/sdk/register-sdk.service.spec.ts index 0a05ac8dbf4..28813262d10 100644 --- a/libs/common/src/platform/services/sdk/register-sdk.service.spec.ts +++ b/libs/common/src/platform/services/sdk/register-sdk.service.spec.ts @@ -76,7 +76,12 @@ describe("DefaultRegisterSdkService", () => { .calledWith(userId) .mockReturnValue(new BehaviorSubject(mock())); accountService.accounts$ = of({ - [userId]: { email: "email", emailVerified: true, name: "name" } as AccountInfo, + [userId]: { + email: "email", + emailVerified: true, + name: "name", + creationDate: "2024-01-01T00:00:00.000Z", + } as AccountInfo, }); }); @@ -125,7 +130,12 @@ describe("DefaultRegisterSdkService", () => { it("destroys the internal SDK client when the account is removed (logout)", async () => { const accounts$ = new BehaviorSubject({ - [userId]: { email: "email", emailVerified: true, name: "name" } as AccountInfo, + [userId]: { + email: "email", + emailVerified: true, + name: "name", + creationDate: "2024-01-01T00:00:00.000Z", + } as AccountInfo, }); accountService.accounts$ = accounts$; diff --git a/libs/common/src/platform/sync/default-sync.service.ts b/libs/common/src/platform/sync/default-sync.service.ts index 04f2950c8ae..8d2ccaffa18 100644 --- a/libs/common/src/platform/sync/default-sync.service.ts +++ b/libs/common/src/platform/sync/default-sync.service.ts @@ -272,7 +272,7 @@ export class DefaultSyncService extends CoreSyncService { await this.tokenService.setSecurityStamp(response.securityStamp, response.id); await this.accountService.setAccountEmailVerified(response.id, response.emailVerified); await this.accountService.setAccountVerifyNewDeviceLogin(response.id, response.verifyDevices); - await this.accountService.setCreationDate(response.id, response.creationDate); + await this.accountService.setAccountCreationDate(response.id, response.creationDate); await this.billingAccountProfileStateService.setHasPremium( response.premiumPersonally, diff --git a/libs/vault/src/components/add-edit-folder-dialog/add-edit-folder-dialog.component.spec.ts b/libs/vault/src/components/add-edit-folder-dialog/add-edit-folder-dialog.component.spec.ts index 68b0d9dfcf5..44d81db6018 100644 --- a/libs/vault/src/components/add-edit-folder-dialog/add-edit-folder-dialog.component.spec.ts +++ b/libs/vault/src/components/add-edit-folder-dialog/add-edit-folder-dialog.component.spec.ts @@ -51,6 +51,7 @@ describe("AddEditFolderDialogComponent", () => { email: "", emailVerified: true, name: undefined, + creationDate: undefined, }; await TestBed.configureTestingModule({