Pleroma.MFA.Totp.provisioning_uri/3: add @spec
This commit is contained in:
parent
f933d24b02
commit
7745ee27bc
|
@ -14,6 +14,7 @@ defmodule Pleroma.MFA.TOTP do
|
||||||
@doc """
|
@doc """
|
||||||
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
||||||
"""
|
"""
|
||||||
|
@spec provisioning_uri(String.t(), String.t(), list()) :: String.t()
|
||||||
def provisioning_uri(secret, label, opts \\ []) do
|
def provisioning_uri(secret, label, opts \\ []) do
|
||||||
query =
|
query =
|
||||||
%{
|
%{
|
||||||
|
@ -27,7 +28,7 @@ def provisioning_uri(secret, label, opts \\ []) do
|
||||||
|> URI.encode_query()
|
|> URI.encode_query()
|
||||||
|
|
||||||
%URI{scheme: "otpauth", host: "totp", path: "/" <> label, query: query}
|
%URI{scheme: "otpauth", host: "totp", path: "/" <> label, query: query}
|
||||||
|> URI.to_string()
|
|> to_string()
|
||||||
end
|
end
|
||||||
|
|
||||||
defp default_period, do: Config.get(@config_ns ++ [:period])
|
defp default_period, do: Config.get(@config_ns ++ [:period])
|
||||||
|
|
Loading…
Reference in New Issue