findByDocTypeHCPartyAndMessage method

Future<List<DecryptedDocumentDto>> findByDocTypeHCPartyAndMessage(
  1. UserDto user,
  2. String documentType,
  3. String hcpId,
  4. DecryptedMessageDto message,
  5. CryptoConfig<DecryptedDocumentDto, DocumentDto> config,
)

Implementation

Future<List<DecryptedDocumentDto>> findByDocTypeHCPartyAndMessage(UserDto user, String documentType, String hcpId, DecryptedMessageDto message, CryptoConfig<DecryptedDocumentDto, DocumentDto> config) async {
  var keys = await config.crypto.decryptEncryptionKeys(user.dataOwnerId()!, message.delegations);
  if (keys.isEmpty) {
    throw FormatException("No delegations for user");
  }

  return this.findByDocTypeHCPartyAndMessageForeignKeys(user, documentType, hcpId, keys.join(","), config);
}