Decrypts the encrypted_<field> attribute back into a value of the original type.
load/3 returning [:"encrypted_<field>"] is the entire dependency declaration. Ash
then auto-selects that attribute even though it is public?: false — ensure_selected/2
does not consult public? — records it in query.context[:private][:depended_on_fields],
and strips it from the returned record, so ciphertext never leaks into results the caller
did not ask for.
Errors are values
This calculation returns {:error, %AshVault.Errors.*{}} and never raises. That is a
deliberate departure from ash_cloak, which raises throughout its crypto path because
Cloak's API is bang-only. AshVault's errors are Splode errors with class: :invalid, so
Ash wraps them correctly and a destroyed tenant comes out of Ash.read/2 as a clean
AshVault.Errors.KeyDestroyed rather than a 500.
It never returns :unknown either — to Ash that means "fall back to the data layer",
which for an encrypted field would silently produce ciphertext or nil.
Field policies
A field policy denying the backing attribute makes Map.get/2 return
%Ash.ForbiddenField{}, which is passed through untouched. AshVault does not
re-implement authorization: if a read reaches this calculation, Ash already authorized it.
Summary
Functions
Callback implementation for Ash.Resource.Calculation.describe/1.
Callback implementation for Ash.Resource.Calculation.has_expression?/0.
Callback implementation for Ash.Resource.Calculation.init/1.
Callback implementation for Ash.Resource.Calculation.strict_loads?/0.
Functions
Callback implementation for Ash.Resource.Calculation.describe/1.
Callback implementation for Ash.Resource.Calculation.has_expression?/0.
Callback implementation for Ash.Resource.Calculation.init/1.
Callback implementation for Ash.Resource.Calculation.strict_loads?/0.