Add encKeyValidation string to encrypted exports (#1412)
This commit is contained in:
parent
569045fcd5
commit
fe58dea3e0
@ -20,13 +20,16 @@ namespace Bit.Core.Services
|
||||
{
|
||||
private readonly IFolderService _folderService;
|
||||
private readonly ICipherService _cipherService;
|
||||
private readonly ICryptoService _cryptoService;
|
||||
|
||||
public ExportService(
|
||||
IFolderService folderService,
|
||||
ICipherService cipherService)
|
||||
ICipherService cipherService,
|
||||
ICryptoService cryptoService)
|
||||
{
|
||||
_folderService = folderService;
|
||||
_cipherService = cipherService;
|
||||
_cryptoService = cryptoService;
|
||||
}
|
||||
|
||||
public async Task<string> GetExport(string format = "csv")
|
||||
@ -37,7 +40,7 @@ namespace Bit.Core.Services
|
||||
var items = (await _cipherService.GetAllAsync()).Where(c => c.OrganizationId == null && c.DeletedDate == null)
|
||||
.Select(c => new CipherWithId(c));
|
||||
|
||||
return ExportEncryptedJson(folders, items);
|
||||
return await ExportEncryptedJson(folders, items);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -177,11 +180,14 @@ namespace Bit.Core.Services
|
||||
});
|
||||
}
|
||||
|
||||
private string ExportEncryptedJson(IEnumerable<FolderWithId> folders, IEnumerable<CipherWithId> ciphers)
|
||||
private async Task<string> ExportEncryptedJson(IEnumerable<FolderWithId> folders, IEnumerable<CipherWithId> ciphers)
|
||||
{
|
||||
var encKeyValidation = await _cryptoService.EncryptAsync(Guid.NewGuid().ToString());
|
||||
|
||||
var jsonDoc = new
|
||||
{
|
||||
Encrypted = true,
|
||||
EncKeyValidation_DO_NOT_EDIT = encKeyValidation.EncryptedString,
|
||||
Folders = folders,
|
||||
Items = ciphers,
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ namespace Bit.Core.Utilities
|
||||
var totpService = new TotpService(storageService, cryptoFunctionService);
|
||||
var authService = new AuthService(cryptoService, apiService, userService, tokenService, appIdService,
|
||||
i18nService, platformUtilsService, messagingService, vaultTimeoutService);
|
||||
var exportService = new ExportService(folderService, cipherService);
|
||||
var exportService = new ExportService(folderService, cipherService, cryptoService);
|
||||
var auditService = new AuditService(cryptoFunctionService, apiService);
|
||||
var environmentService = new EnvironmentService(apiService, storageService);
|
||||
var eventService = new EventService(storageService, apiService, userService, cipherService);
|
||||
|
Loading…
x
Reference in New Issue
Block a user