diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-06 17:04:53 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-06 17:04:53 +0000 |
commit | 537a048ccc70b70723343c08602573b18e93f246 (patch) | |
tree | fd90548aad0f98635f1856ef029ff25b852bf607 /registry | |
parent | eb322d739df93319f78ce2e1f884ace46a6b88c8 (diff) | |
download | communique-537a048ccc70b70723343c08602573b18e93f246.tar.gz |
try this again
Diffstat (limited to 'registry')
-rw-r--r-- | registry/registry.go | 16 |
1 files changed, 7 insertions, 9 deletions
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 } |