From b10b9f6dc993e1757b702dd6def09df65cecfa44 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Thu, 5 Jan 2023 19:18:32 -0500 Subject: log signature string --- registry/registry.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/registry/registry.go b/registry/registry.go index 01d92c7..f1ec426 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -272,12 +272,17 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol request.Header.Add("Digest", "SHA-256="+digestHeader) request.Header.Add("Content-Type", "application/activity+json") + signedString := fmt.Sprintf("(request-target): post %s\ncontent-type: %s\ndate: %s\ndigest: %s\nhost: %s", url.Path, request.Header.Get("Content-Type"), date, digestHeader, url.Host) + r.log.With( "type", "delivery", ).With( "payload", payload, + ).With( + "signature string", + signedString, ).With( "date", request.Header.Get("date"), @@ -286,10 +291,8 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol request.Header.Get("host"), ).Debugf("signing request") - signed_string := fmt.Sprintf("(request-target): post %s\ncontent-type: %s\ndate: %s\ndigest: %s\nhost: %s", url.Path, request.Header.Get("Content-Type"), date, digestHeader, url.Host) - digest := sha256.New() - digest.Write([]byte(signed_string)) + digest.Write([]byte(signedString)) digestBytes := digest.Sum(nil) r.mu.Lock() -- cgit v1.2.3