IN PROGRESS- Probably lots of errors
TODO: Encrypted Data (Passwords)
bcrypt Simple encryption in Elixir Alchemist Encryption Phoenix Password Authenticcation Phoenix Auth Practices
actions do
create :signup do
argument :password, :string
argument :password_confirmation, :string
validate confirm(:password, :password_confirmation)
change {MyApp.HashPassword, []} # A custom implemented Change
end
end
Zach Daniel — 11/14/2021 Yep, that sounds correct to me nothing currently allows you to have an attribute that is write only and never read back when running queries e.g it will still be present on the struct but if its encrypted then thats not really problematic but for example in cases where we’re storing a password we have a password argument and a password_hash private/not-writable/sensitive attribute
attributes do
# Add an autogenerated UUID primary key called `:id`.
attributes do
uuid_primary_key :id
attribute :email, :string do
allow_nil? false
constraints [
match: ~r/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$/
]
end
attribute :password_hash, :string do
private? true
writable? false
sensitive? true
end
create_timestamp :inserted_at
update_timestamp :updated_at
end
actions do
create :signup do
argument :password, :string
argument :password_confirmation, :string
validate confirm(:password, :password_confirmation)
change {MyApp.HashPassword, []} # A custom implemented Change
end
end
Resources
Documentation
- https://www.ash-hq.org/
- https://hexdocs.pm/ash/get-started.html
- https://www.ash-hq.org/docs/guides/ash/2.4.1/tutorials/get-started.md
- https://github.com/phoenixframework/phoenix/blob/master/installer/README.md
Ash Framework 1.5 - Video and Slides