From 71a0f64ff0f2a78b5676770e0da85a096ba9f682 Mon Sep 17 00:00:00 2001 From: Annopaolo Date: Tue, 23 Mar 2021 15:44:03 +0100 Subject: [PATCH] revision Signed-off-by: Annopaolo --- lib/cfxxl.ex | 6 ++++-- lib/cfxxl/cert_utils.ex | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/cfxxl.ex b/lib/cfxxl.ex index f34c2f2..f71a0e3 100644 --- a/lib/cfxxl.ex +++ b/lib/cfxxl.ex @@ -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 @@ -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) diff --git a/lib/cfxxl/cert_utils.ex b/lib/cfxxl/cert_utils.ex index b3b7edc..bac3163 100644 --- a/lib/cfxxl/cert_utils.ex +++ b/lib/cfxxl/cert_utils.ex @@ -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]) @@ -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 @@ -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()