commit: 84b15ac1119396eeb9827fc5242489a4f5cb820b
parent a964368e31ddf8a22dd36bbf2aae51f7d91bbdaf
Author: Mark Felder <feld@feld.me>
Date: Thu, 25 Jul 2024 16:18:31 -0400
Improve specs and matching
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/pleroma/signature.ex b/lib/pleroma/signature.ex
@@ -94,8 +94,8 @@ defmodule Pleroma.Signature do
Timex.format!(date, "{WDshort}, {0D} {Mshort} {YYYY} {h24}:{m}:{s} GMT")
end
- @spec validate_signature(map(), String.t()) :: boolean()
- def validate_signature(conn, request_target) do
+ @spec validate_signature(Plug.Conn.t(), String.t()) :: boolean()
+ def validate_signature(%Plug.Conn{} = conn, request_target) do
# Newer drafts for HTTP signatures now use @request-target instead of the
# old (request-target). We'll now support both for incoming signatures.
conn =
@@ -106,8 +106,8 @@ defmodule Pleroma.Signature do
@http_signatures_impl.validate_conn(conn)
end
- @spec validate_signature(map()) :: boolean()
- def validate_signature(conn) do
+ @spec validate_signature(Plug.Conn.t()) :: boolean()
+ def validate_signature(%Plug.Conn{} = conn) do
# This (request-target) is non-standard, but many implementations do it
# this way due to a misinterpretation of
# https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-06