-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add `WebauthnUser` struct * use new struct in registration component * rm `:user_handle` from registration and docs * undo js user object manipulation * add custom jason encoder impl to camel-case `:display_name` * handle `webauthn_user` updates * report invalid webauthn user to parent LV * send `key_id` instead of `user_handle`, misc formatting * update auth component docs * version bump * fix broken test * update docs * rename `:find_credential` message * update readme
- Loading branch information
Showing
9 changed files
with
122 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule WebauthnComponents.WebauthnUser do | ||
@moduledoc """ | ||
Struct representing required fields used by the WebAuthn API. | ||
""" | ||
@enforce_keys [:id, :name, :display_name] | ||
defstruct [:id, :name, :display_name] | ||
|
||
@type t :: %__MODULE__{ | ||
id: binary(), | ||
name: String.t(), | ||
display_name: String.t() | ||
} | ||
|
||
defimpl Jason.Encoder, for: __MODULE__ do | ||
def encode(struct, opts) do | ||
map = | ||
struct | ||
|> Map.from_struct() | ||
|> Map.put(:displayName, struct.display_name) | ||
|> Map.delete(:display_name) | ||
|
||
Jason.Encode.map(map, opts) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters