From 9f0574cb5b1b8849266680d4159559a2d62a81aa Mon Sep 17 00:00:00 2001 From: doofyus Date: Fri, 17 May 2024 14:29:31 +0300 Subject: [PATCH] improve `JWT.verify_strict/3` typespec with error tuple --- lib/jose/jwt.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jose/jwt.ex b/lib/jose/jwt.ex index 3692642..8ba4807 100644 --- a/lib/jose/jwt.ex +++ b/lib/jose/jwt.ex @@ -309,7 +309,8 @@ defmodule JOSE.JWT do @doc """ Verifies the `signed` using the `jwk`, whitelists the `"alg"` using `allow`, and calls `from/1` on the payload. See `JOSE.JWS.verify_strict/3`. """ - @spec verify_strict(JOSE.JWK.t(), [String.t()], binary()) :: {valid? :: boolean(), jwt :: t(), jws :: JOSE.JWS.t()} + @spec verify_strict(JOSE.JWK.t(), [String.t()], binary()) :: + {valid? :: boolean(), jwt :: t(), jws :: JOSE.JWS.t()} | {:error, any()} def verify_strict(jwk = %JOSE.JWK{}, allow, signed), do: verify_strict(JOSE.JWK.to_record(jwk), allow, signed) def verify_strict(jwk = [%JOSE.JWK{} | _], allow, signed) do