diff --git a/lib/nerves_hub/devices.ex b/lib/nerves_hub/devices.ex index ec7000a73..832998854 100644 --- a/lib/nerves_hub/devices.ex +++ b/lib/nerves_hub/devices.ex @@ -239,7 +239,9 @@ defmodule NervesHub.Devices do end end - def get_or_create_device(token_auth: token_auth, identifier: identifier) do + @spec get_or_create_device(TokenAuth.t(), String.t()) :: + {:ok, Device.t()} | {:error, :not_found} + def get_or_create_device(%TokenAuth{} = token_auth, identifier) do with {:error, :not_found} <- get_active_device(product_id: token_auth.product_id, identifier: identifier), {:ok, product} <- diff --git a/lib/nerves_hub_web/channels/device_socket_token_auth.ex b/lib/nerves_hub_web/channels/device_socket_token_auth.ex index 950a0379f..5746c5e20 100644 --- a/lib/nerves_hub_web/channels/device_socket_token_auth.ex +++ b/lib/nerves_hub_web/channels/device_socket_token_auth.ex @@ -31,7 +31,7 @@ defmodule NervesHubWeb.DeviceSocketTokenAuth do {:ok, identifier} <- Crypto.verify(token_auth.secret, salt, signature, verification_options), {:ok, device} <- - Devices.get_or_create_device(token_auth: token_auth, identifier: identifier) do + Devices.get_or_create_device(token_auth, identifier) do socket = socket |> assign(:device, device)