modifyDocuments method

Implementation

Future<List<DecryptedDocumentDto>?> modifyDocuments(UserDto user, List<DecryptedDocumentDto> documents, CryptoConfig<DecryptedDocumentDto, DocumentDto> config) async {
  var modifiedDocuments = await this.rawModifyDocuments(await Future.wait(documents.map((document) => config.encryptDocument(
      user.dataOwnerId()!, <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})}, document))));

  return modifiedDocuments == null
      ? null
      : await Future.wait(modifiedDocuments.map((newDocument) => config.decryptDocument(user.dataOwnerId()!, newDocument)));
}