View Source WebauthnComponents.CoseKey (WebauthnComponents v0.8.0)
Custom Ecto.Type
for WebAuthn cose keys.
Use this type for the :public_key
field in an Ecto schema.
Example
defmodule MyApp.Authentication.UserKey do
use Ecto.Schema
import Ecto.Changeset
alias MyApp.Accounts.User
alias WebauthnComponents.CoseKey
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
@derive {Jason.Encoder, only: [:key_id, :public_key, :label, :last_used]}
schema "user_keys" do
field :label, :string, default: "default"
field :key_id, :binary
field :public_key, CoseKey
belongs_to :user, User
field :last_used, :utc_datetime
timestamps()
end
...
end
Summary
Functions
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.dump/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.load/1
.
Callback implementation for Ecto.Type.type/0
.
Functions
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.dump/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.load/1
.
Callback implementation for Ecto.Type.type/0
.