mirror of
https://github.com/bitwarden/browser.git
synced 2024-08-31 00:01:03 +02:00
[send.key] Update send.key when rotating account enc key (#1049)
* Update send.key when rotating account enc key * Update jslib
This commit is contained in:
parent
d85ee9780f
commit
5e7e035eec
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit 58be5796b0c2b19aacf52d4a1c179aeb80924443
|
||||
Subproject commit 00acbce556c015fae9e6281ea7db2e704ec96c26
|
|
@ -9,6 +9,7 @@ import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
|||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||
import { SendService } from 'jslib-common/abstractions/send.service';
|
||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||
|
||||
|
@ -27,6 +28,7 @@ import { EmergencyAccessUpdateRequest } from 'jslib-common/models/request/emerge
|
|||
import { FolderWithIdRequest } from 'jslib-common/models/request/folderWithIdRequest';
|
||||
import { OrganizationUserResetPasswordEnrollmentRequest } from 'jslib-common/models/request/organizationUserResetPasswordEnrollmentRequest';
|
||||
import { PasswordRequest } from 'jslib-common/models/request/passwordRequest';
|
||||
import { SendWithIdRequest } from 'jslib-common/models/request/sendWithIdRequest';
|
||||
import { UpdateKeyRequest } from 'jslib-common/models/request/updateKeyRequest';
|
||||
|
||||
@Component({
|
||||
|
@ -42,7 +44,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
|
|||
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
||||
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
||||
private folderService: FolderService, private cipherService: CipherService,
|
||||
private syncService: SyncService, private apiService: ApiService) {
|
||||
private syncService: SyncService, private apiService: ApiService, private sendService: SendService) {
|
||||
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
|
||||
platformUtilsService, policyService);
|
||||
}
|
||||
|
@ -164,6 +166,13 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
|
|||
request.ciphers.push(new CipherWithIdRequest(cipher));
|
||||
}
|
||||
|
||||
const sends = await this.sendService.getAll();
|
||||
await Promise.all(sends.map(async send => {
|
||||
const cryptoKey = await this.cryptoService.decryptToBytes(send.key, null);
|
||||
send.key = await this.cryptoService.encrypt(cryptoKey, encKey[0]) ?? send.key;
|
||||
request.sends.push(new SendWithIdRequest(send));
|
||||
}));
|
||||
|
||||
await this.apiService.postAccountKey(request);
|
||||
|
||||
await this.updateEmergencyAccesses(encKey[0]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user