WebAuthN auth

This commit is contained in:
bluepython508
2023-11-05 01:12:02 +00:00
parent 45e4e9f5da
commit 092930a24f
33 changed files with 1123 additions and 463 deletions

View File

@@ -0,0 +1,30 @@
defmodule SsoBsn.Accounts.UserKey do
use Ecto.Schema
import Ecto.Changeset
alias SsoBsn.Accounts.User
defmodule BinaryTerm do
use Ecto.Type
def type, do: :binary
def cast(term), do: {:ok, term}
def load(data) when is_binary(data), do: {:ok, :erlang.binary_to_term(data)}
def dump(term), do: {:ok, :erlang.term_to_binary(term)} |> dbg()
end
alias SsoBsn.Accounts.UserKey.BinaryTerm
schema "users_keys" do
field :key_id, :string
field :cose_key, BinaryTerm
belongs_to :user, User
end
def new(key, attrs) do
key
|> cast(attrs, [:key_id, :cose_key])
end
end