Skip to content

Commit

Permalink
Update origin (#53)
Browse files Browse the repository at this point in the history
* use `URI.to_string/1`

* bump version to 0.6.2

* handle not-mounted uri for tests
  • Loading branch information
type1fool committed Sep 26, 2023
1 parent 532007f commit 0909c61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/webauthn_components/registration_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ defmodule WebauthnComponents.RegistrationComponent do
end

def handle_event("register", _params, socket) do
%{assigns: assigns, host_uri: host_uri} = socket
%{assigns: assigns, endpoint: endpoint, host_uri: host_uri} = socket

%{
app: app_name,
Expand All @@ -125,10 +125,16 @@ defmodule WebauthnComponents.RegistrationComponent do

attestation = "none"

origin =
case host_uri do
%URI{} -> URI.to_string(host_uri)
_ -> endpoint.url
end

challenge =
Wax.new_registration_challenge(
attestation: attestation,
origin: host_uri.host,
origin: origin,
rp_id: :auto,
trusted_attestation_types: [:none, :basic]
)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule WebauthnComponents.MixProject do
# Don't forget to change the version in `package.json`
@name "WebauthnComponents"
@source_url "https://github.com/liveshowy/webauthn_components"
@version "0.6.2"
@version "0.6.3"

def project do
[
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webauthn_components",
"version": "0.6.2",
"version": "0.6.3",
"main": "./priv/static/main.js",
"repository": {},
"files": [
Expand Down

0 comments on commit 0909c61

Please sign in to comment.