Skip to content

Commit

Permalink
revision
Browse files Browse the repository at this point in the history
Signed-off-by: Annopaolo <[email protected]>
  • Loading branch information
Annopaolo committed Mar 23, 2021
1 parent 01c5a21 commit 71a0f64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/cfxxl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ defmodule CFXXL do
end
end

@spec extract_error_message(%{required(String.t()) => list()}) :: any()
@spec extract_error_message(%{required(String.t()) => list()}) :: String.t()
defp extract_error_message(%{"errors" => errors}) do
case errors do
[%{"message" => msg} | _] -> msg
Expand All @@ -471,18 +471,20 @@ defmodule CFXXL do
|> String.replace(":", "")
end

@spec filter_opts(list(), list()) :: list()
@spec filter_opts(keyword(), list()) :: keyword()
defp filter_opts(opts, accepted_opts) do
opts
|> Enum.filter(fn {k, _} -> k in accepted_opts end)
end

@spec newkey_request(list(), DName.t(), keyword()) :: map()
defp newkey_request(hosts, dname, opts) do
opts
|> filter_opts(@newkey_opts)
|> Enum.into(%{hosts: hosts, names: dname})
end

@spec sign_request(any(), keyword()) :: map()
defp sign_request(csr, opts) do
opts
|> filter_opts(@sign_opts)
Expand Down
5 changes: 3 additions & 2 deletions lib/cfxxl/cert_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ defmodule CFXXL.CertUtils do
|> cert_time_tuple_to_datetime()
end

@spec cert_time_tuple_to_datetime({:utcTime | :generalTime, nonempty_list(non_neg_integer())}) ::
@spec cert_time_tuple_to_datetime({:utcTime | :generalTime, iolist()}) ::
DateTime.t()
defp cert_time_tuple_to_datetime({:utcTime, [y0, y1 | _rest] = time_charlist}) do
short_year = parse_charlist_int([y0, y1])
Expand Down Expand Up @@ -199,6 +199,7 @@ defmodule CFXXL.CertUtils do
DateTime.from_naive!(naive, "Etc/UTC")
end

@spec parse_charlist_int(iolist()) :: integer()
defp parse_charlist_int(charlist) do
{parsed, ""} =
charlist
Expand All @@ -209,7 +210,7 @@ defmodule CFXXL.CertUtils do
end

@spec tbs(binary) :: any
def tbs(cert) do
defp tbs(cert) do
cert
|> :public_key.pem_decode()
|> hd()
Expand Down

0 comments on commit 71a0f64

Please sign in to comment.