Ash FrameworkAF
Ash Framework5mo ago
4 replies
EAJ

Filter by encrypted attribute

I am storing some personal information (national identification numbers,), and encrypting it with ash_cloak. I'd like to implement an action where I search for users given a national identification number as an argument. With the filter
      filter expr(national_identity_number == ^arg(:query))

I get this error:
** (Ash.Error.Invalid)
Invalid Error

* national_identity_number cannot be referenced in filters
    at filter
  (ash 3.5.26) lib/ash/error/query/invalid_filter_reference.ex:4: Ash.Error.Query.InvalidFilterReference.exception/1
  (ash 3.5.26) lib/ash/filter/filter.ex:391: anonymous fn/2 in Ash.Filter.validate_references/2
  (elixir 1.18.4) lib/enum.ex:4442: Enum.flat_map_list/2
 # further stack trace cut

Is there any way to accomplish this?
Was this page helpful?