createContacts method

Implementation

Future<List<DecryptedContactDto>?> createContacts(
    UserDto user, List<DecryptedContactDto> contacts, CryptoConfig<DecryptedContactDto, ContactDto> config) async {

  var newContacts = await this.rawCreateContacts(await Future.wait(contacts.map((contact) async => config.encryptContact(
      user.dataOwnerId()!, <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})}, await contact.initDelegations(user, config)))));

  return newContacts == null
      ? null
      : await Future.wait(newContacts.map((newContact) => config.decryptContact(user.dataOwnerId()!, newContact)));
}