Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/models/registration_response.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ defmodule U2FEx.RegistrationResponse do
end

@spec do_from_json(map()) :: {:ok, __MODULE__.t()} | {:error, :u2f}
defp do_from_json(%{"errorCode" => error}), do: Errors.get_retval_from_error(error)

defp do_from_json(%{"registrationData" => registration_data}) do
registration_data
|> Utils.b64_decode()
|> from_binary()
end

defp do_from_json(%{"errorCode" => error}), do: Errors.get_retval_from_error(error)

@doc """
Exports a RegistrationResponse -> KeyMetadata for finishing registration on consumer applications side.
"""
Expand Down
5 changes: 3 additions & 2 deletions lib/models/sign_response.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ defmodule U2FEx.SignResponse do
| :u2f_configuration_unsupported
| :u2f_device_ineligible
| :u2f_timeout}
defp do_from_json(%{"errorCode" => error}), do: Errors.get_retval_from_error(error)

defp do_from_json(%{
"signatureData" => s,
"clientData" => c,
Expand All @@ -122,4 +120,7 @@ defmodule U2FEx.SignResponse do
key_handle = Utils.b64_decode(k)
from_binary(key_handle, client_data, signature_data)
end

defp do_from_json(%{"errorCode" => error}), do: Errors.get_retval_from_error(error)

end