modifyContacts method

Implementation

Future<List<DecryptedContactDto>?> modifyContacts(
    UserDto user, List<DecryptedContactDto> contacts, CryptoConfig<DecryptedContactDto, ContactDto> config) async {
  var modifiedContacts = await this.rawModifyContacts(await Future.wait(contacts.map((contact) => config.encryptContact(
      user.dataOwnerId()!, <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})}, contact))));
  return modifiedContacts == null
      ? null
      : await Future.wait(modifiedContacts.map((newContact) => config.decryptContact(user.dataOwnerId()!, newContact)));
}