From 537a048ccc70b70723343c08602573b18e93f246 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Fri, 6 Jan 2023 12:04:53 -0500 Subject: try this again --- registry/registry.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'registry/registry.go') diff --git a/registry/registry.go b/registry/registry.go index 1901f0c..cc99d63 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -3,9 +3,7 @@ package registry import ( "bytes" "context" - "crypto/sha256" "crypto/x509" - "encoding/base64" "encoding/gob" "encoding/json" "encoding/pem" @@ -263,11 +261,11 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol request.Header.Set("Content-Type", "application/activity+json") request.Header.Set("Host", url.Host) - h := sha256.New() - h.Write(jsonData) - digestHeader := base64.StdEncoding.Strict().EncodeToString(h.Sum(nil)) - request.Header.Add("Digest", "SHA-256="+digestHeader) - request.Header.Add("Content-Type", "application/activity+json") + // h := sha256.New() + // h.Write(jsonData) + // digestHeader := base64.StdEncoding.Strict().EncodeToString(h.Sum(nil)) + // request.Header.Add("Digest", "SHA-256="+digestHeader) + // request.Header.Add("Content-Type", "application/activity+json") signedString := fmt.Sprintf("(request-target): post %s\ndate: %s\ndigest: %s\nhost: %s", url.Path, date, digestHeader, url.Host) @@ -311,8 +309,8 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol prefs := []httpsig.Algorithm{} digestAlgorithm := httpsig.DigestSha256 // The "Date" and "Digest" headers must already be set on r, as well as r.URL. - headersToSign := []string{httpsig.RequestTarget, "host", "date", "digest", "content-type"} - signer, _, err := httpsig.NewSigner(prefs, digestAlgorithm, headersToSign, httpsig.Signature, 100) + headersToSign := []string{httpsig.RequestTarget, "host", "date", "digest"} + signer, _, err := httpsig.NewSigner(prefs, digestAlgorithm, headersToSign, httpsig.Signature, 0) if err != nil { return err } -- cgit v1.2.3