mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
Add encKey validation for org import/export (#392)
This commit is contained in:
parent
6fbe33043b
commit
dddcc2bc93
@ -38,8 +38,9 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
|
||||
private async parseEncrypted() {
|
||||
if (this.results.encKeyValidation_DO_NOT_EDIT != null) {
|
||||
const orgKey = await this.cryptoService.getOrgKey(this.organizationId);
|
||||
const encKeyValidation = new EncString(this.results.encKeyValidation_DO_NOT_EDIT);
|
||||
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(encKeyValidation);
|
||||
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(encKeyValidation, orgKey);
|
||||
if (encKeyValidationDecrypt === null) {
|
||||
this.result.success = false;
|
||||
this.result.errorMessage = this.i18nService.t('importEncKeyError');
|
||||
|
@ -289,8 +289,12 @@ export class ExportService implements ExportServiceAbstraction {
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
const orgKey = await this.cryptoService.getOrgKey(organizationId);
|
||||
const encKeyValidation = await this.cryptoService.encrypt(Utils.newGuid(), orgKey);
|
||||
|
||||
const jsonDoc: any = {
|
||||
encrypted: true,
|
||||
encKeyValidation_DO_NOT_EDIT: encKeyValidation.encryptedString,
|
||||
collections: [],
|
||||
items: [],
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user