1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 14:04:03 +00:00

[PM-30828] added MP reprompt check to unarchive (#18464)

This commit is contained in:
Jason Ng
2026-01-21 17:16:18 -05:00
committed by GitHub
parent 714ff1aba3
commit 9dd94a2782
2 changed files with 22 additions and 1 deletions

View File

@@ -120,5 +120,19 @@ describe("ArchiveCipherUtilitiesService", () => {
message: "errorOccurred",
});
});
it("calls password reprompt check when unarchiving", async () => {
await service.unarchiveCipher(mockCipher);
expect(passwordRepromptService.passwordRepromptCheck).toHaveBeenCalledWith(mockCipher);
});
it("returns early when password reprompt fails on unarchive", async () => {
passwordRepromptService.passwordRepromptCheck.mockResolvedValue(false);
await service.unarchiveCipher(mockCipher);
expect(cipherArchiveService.unarchiveWithServer).not.toHaveBeenCalled();
});
});
});

View File

@@ -74,7 +74,14 @@ export class ArchiveCipherUtilitiesService {
* @param cipher The cipher to unarchive
* @returns The unarchived cipher on success, or undefined on failure
*/
async unarchiveCipher(cipher: CipherView) {
async unarchiveCipher(cipher: CipherView, skipReprompt = false) {
if (!skipReprompt) {
const repromptPassed = await this.passwordRepromptService.passwordRepromptCheck(cipher);
if (!repromptPassed) {
return;
}
}
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
try {
const cipherResponse = await this.cipherArchiveService.unarchiveWithServer(