diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-06 00:18:32 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-06 00:18:32 +0000 |
commit | b10b9f6dc993e1757b702dd6def09df65cecfa44 (patch) | |
tree | 312a926817ca7eabf5c2276004c735634388a600 /registry | |
parent | 786d49b884124e5cf83594558974999078b90242 (diff) | |
download | communique-b10b9f6dc993e1757b702dd6def09df65cecfa44.tar.gz |
log signature string
Diffstat (limited to 'registry')
-rw-r--r-- | registry/registry.go | 9 |
1 files 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,6 +272,8 @@ 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", @@ -279,6 +281,9 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol "payload", payload, ).With( + "signature string", + signedString, + ).With( "date", request.Header.Get("date"), ).With( @@ -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() |