Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JOSE.JWE.compact/1 @spec #166

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

kpanic
Copy link
Contributor

@kpanic kpanic commented Apr 12, 2024

Hey there 👋🏾 thanks for the fantastic library! 🎉

I figured out that there might be a @spec error when running dialyzer from my app.

The code is more or less this:

jwk
|> JOSE.JWE.block_encrypt(Jason.encode!(payload), %{
  "alg" => @alg,
  "enc" => @enc
})
|> JOSE.JWE.compact()
|> elem(1)

The dialyzer complaint (from my side) is:

The function call will not succeed.
JOSE.JWE.compact({%{:alg => atom(), :enc => atom(), :zip => atom()}, %{<<_::16, _::size(8)>> => binary()}}) ::
  :ok
def a() do
  :ok
end

breaks the contract
(map()) :: {map(), binary()}

PS: I am not sure if {map(), map()} is 100% correct. Please let me know

@potatosalad
Copy link
Owner

@kpanic Thanks!

@potatosalad potatosalad merged commit bd96bde into potatosalad:main Apr 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants