1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 11:43:46 +00:00

[deps] Autofill: Update prettier to v3 (#7014)

* [deps] Autofill: Update prettier to v3

* prettier formatting updates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
renovate[bot]
2023-11-29 16:15:20 -05:00
committed by GitHub
parent 4ff5f38e89
commit 28de9439be
1145 changed files with 5898 additions and 5612 deletions

View File

@@ -31,7 +31,7 @@ export class MigrateFromLegacyEncryptionComponent {
private migrationService: MigrateFromLegacyEncryptionService,
private cryptoService: CryptoService,
private messagingService: MessagingService,
private logService: LogService
private logService: LogService,
) {}
submit = async () => {
@@ -51,9 +51,8 @@ export class MigrateFromLegacyEncryptionComponent {
try {
// Create new user key
const [newUserKey, masterKeyEncUserKey] = await this.migrationService.createNewUserKey(
masterPassword
);
const [newUserKey, masterKeyEncUserKey] =
await this.migrationService.createNewUserKey(masterPassword);
// Update admin recover keys
await this.migrationService.updateAllAdminRecoveryKeys(masterPassword, newUserKey);
@@ -65,14 +64,14 @@ export class MigrateFromLegacyEncryptionComponent {
await this.migrationService.updateKeysAndEncryptedData(
masterPassword,
newUserKey,
masterKeyEncUserKey
masterKeyEncUserKey,
);
this.platformUtilsService.showToast(
"success",
this.i18nService.t("keyUpdated"),
this.i18nService.t("logBackInOthersToo"),
{ timeout: 15000 }
{ timeout: 15000 },
);
this.messagingService.send("logout");
} catch (e) {

View File

@@ -66,7 +66,7 @@ describe("migrateFromLegacyEncryptionService", () => {
cipherService,
folderService,
sendService,
stateService
stateService,
);
});
@@ -86,7 +86,7 @@ describe("migrateFromLegacyEncryptionService", () => {
cryptoService.isLegacyUser.mockResolvedValue(false);
await expect(
migrateFromLegacyEncryptionService.createNewUserKey(mockMasterPassword)
migrateFromLegacyEncryptionService.createNewUserKey(mockMasterPassword),
).rejects.toThrowError("Invalid master password or user may not be legacy");
});
});
@@ -109,7 +109,7 @@ describe("migrateFromLegacyEncryptionService", () => {
cryptoService.getPrivateKey.mockResolvedValue(new Uint8Array(64) as CsprngArray);
cryptoService.rsaEncrypt.mockResolvedValue(
new EncString(EncryptionType.AesCbc256_HmacSha256_B64, "Encrypted")
new EncString(EncryptionType.AesCbc256_HmacSha256_B64, "Encrypted"),
);
folderViews = new BehaviorSubject<FolderView[]>(mockFolders);
@@ -122,7 +122,7 @@ describe("migrateFromLegacyEncryptionService", () => {
encryptService.encrypt.mockImplementation((plainValue, userKey) => {
return Promise.resolve(
new EncString(EncryptionType.AesCbc256_HmacSha256_B64, "Encrypted: " + plainValue)
new EncString(EncryptionType.AesCbc256_HmacSha256_B64, "Encrypted: " + plainValue),
);
});
@@ -131,7 +131,7 @@ describe("migrateFromLegacyEncryptionService", () => {
encryptedFolder.id = folder.id;
encryptedFolder.name = new EncString(
EncryptionType.AesCbc256_HmacSha256_B64,
"Encrypted: " + folder.name
"Encrypted: " + folder.name,
);
return Promise.resolve(encryptedFolder);
});
@@ -141,7 +141,7 @@ describe("migrateFromLegacyEncryptionService", () => {
encryptedCipher.id = cipher.id;
encryptedCipher.name = new EncString(
EncryptionType.AesCbc256_HmacSha256_B64,
"Encrypted: " + cipher.name
"Encrypted: " + cipher.name,
);
return Promise.resolve(encryptedCipher);
});
@@ -151,7 +151,7 @@ describe("migrateFromLegacyEncryptionService", () => {
await migrateFromLegacyEncryptionService.updateKeysAndEncryptedData(
mockMasterPassword,
mockUserKey,
mockEncUserKey
mockEncUserKey,
);
expect(cryptoService.getOrDeriveMasterKey).toHaveBeenCalled();
@@ -161,7 +161,7 @@ describe("migrateFromLegacyEncryptionService", () => {
await migrateFromLegacyEncryptionService.updateKeysAndEncryptedData(
mockMasterPassword,
mockUserKey,
mockEncUserKey
mockEncUserKey,
);
expect(syncService.fullSync).toHaveBeenCalledWith(true);
});
@@ -173,8 +173,8 @@ describe("migrateFromLegacyEncryptionService", () => {
migrateFromLegacyEncryptionService.updateKeysAndEncryptedData(
mockMasterPassword,
mockUserKey,
mockEncUserKey
)
mockEncUserKey,
),
).rejects.toThrowError("sync failed");
expect(apiService.postAccountKey).not.toHaveBeenCalled();
@@ -189,8 +189,8 @@ describe("migrateFromLegacyEncryptionService", () => {
migrateFromLegacyEncryptionService.updateKeysAndEncryptedData(
mockMasterPassword,
mockUserKey,
mockEncUserKey
)
mockEncUserKey,
),
).rejects.toThrowError("Ciphers failed to be retrieved");
expect(apiService.postAccountKey).not.toHaveBeenCalled();
@@ -240,36 +240,36 @@ describe("migrateFromLegacyEncryptionService", () => {
it("Only updates organizations that are enrolled in admin recovery", async () => {
await migrateFromLegacyEncryptionService.updateAllAdminRecoveryKeys(
mockMasterPassword,
mockUserKey
mockUserKey,
);
expect(
organizationUserService.putOrganizationUserResetPasswordEnrollment
organizationUserService.putOrganizationUserResetPasswordEnrollment,
).toHaveBeenCalledWith(
"1",
expect.any(String),
expect.any(OrganizationUserResetPasswordEnrollmentRequest)
expect.any(OrganizationUserResetPasswordEnrollmentRequest),
);
expect(
organizationUserService.putOrganizationUserResetPasswordEnrollment
organizationUserService.putOrganizationUserResetPasswordEnrollment,
).toHaveBeenCalledWith(
"2",
expect.any(String),
expect.any(OrganizationUserResetPasswordEnrollmentRequest)
expect.any(OrganizationUserResetPasswordEnrollmentRequest),
);
expect(
organizationUserService.putOrganizationUserResetPasswordEnrollment
organizationUserService.putOrganizationUserResetPasswordEnrollment,
).not.toHaveBeenCalledWith(
"3",
expect.any(String),
expect.any(OrganizationUserResetPasswordEnrollmentRequest)
expect.any(OrganizationUserResetPasswordEnrollmentRequest),
);
expect(
organizationUserService.putOrganizationUserResetPasswordEnrollment
organizationUserService.putOrganizationUserResetPasswordEnrollment,
).not.toHaveBeenCalledWith(
"4",
expect.any(String),
expect.any(OrganizationUserResetPasswordEnrollmentRequest)
expect.any(OrganizationUserResetPasswordEnrollmentRequest),
);
});
});

View File

@@ -38,7 +38,7 @@ export class MigrateFromLegacyEncryptionService {
private cipherService: CipherService,
private folderService: FolderService,
private sendService: SendService,
private stateService: StateService
private stateService: StateService,
) {}
/**
@@ -51,7 +51,7 @@ export class MigrateFromLegacyEncryptionService {
masterPassword,
await this.stateService.getEmail(),
await this.stateService.getKdfType(),
await this.stateService.getKdfConfig()
await this.stateService.getKdfConfig(),
);
if (!masterKey) {
@@ -77,14 +77,14 @@ export class MigrateFromLegacyEncryptionService {
async updateKeysAndEncryptedData(
masterPassword: string,
newUserKey: UserKey,
newEncUserKey: EncString
newEncUserKey: EncString,
): Promise<void> {
// Create new request and add master key and hash
const request = new UpdateKeyRequest();
request.key = newEncUserKey.encryptedString;
request.masterPasswordHash = await this.cryptoService.hashMasterKey(
masterPassword,
await this.cryptoService.getOrDeriveMasterKey(masterPassword)
await this.cryptoService.getOrDeriveMasterKey(masterPassword),
);
// Sync before encrypting to make sure we have latest data
@@ -132,13 +132,13 @@ export class MigrateFromLegacyEncryptionService {
request.resetPasswordKey = encryptedKey.encryptedString;
request.masterPasswordHash = await this.cryptoService.hashMasterKey(
masterPassword,
await this.cryptoService.getOrDeriveMasterKey(masterPassword)
await this.cryptoService.getOrDeriveMasterKey(masterPassword),
);
await this.organizationUserService.putOrganizationUserResetPasswordEnrollment(
org.id,
org.userId,
request
request,
);
}
}
@@ -160,7 +160,7 @@ export class MigrateFromLegacyEncryptionService {
folders.map(async (folder) => {
const encryptedFolder = await this.folderService.encrypt(folder, newUserKey);
return new FolderWithIdRequest(encryptedFolder);
})
}),
);
}
@@ -173,7 +173,7 @@ export class MigrateFromLegacyEncryptionService {
ciphers.map(async (cipher) => {
const encryptedCipher = await this.cipherService.encrypt(cipher, newUserKey);
return new CipherWithIdRequest(encryptedCipher);
})
}),
);
}
@@ -187,7 +187,7 @@ export class MigrateFromLegacyEncryptionService {
const sendKey = await this.encryptService.decryptToBytes(send.key, null);
send.key = (await this.encryptService.encrypt(sendKey, newUserKey)) ?? send.key;
return new SendWithIdRequest(send);
})
}),
);
}
}