From 80f545a71d24ebc6ffeedd421d161a83430608b1 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Thu, 5 Jan 2023 11:40:35 -0500 Subject: set keyurl --- registry/registry.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'registry/registry.go') diff --git a/registry/registry.go b/registry/registry.go index 475464f..daf16b4 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -205,7 +205,12 @@ func (r *Registry) Inbox(name string, req *http.Request, payload []byte) error { url := inboxProp.GetIRI() logger.With("actor", idPropUrl).With("inbox", url).Debugf("follow") - r.deliverAcceptToInbox(url, actorUrl, follow, handler.handlerCfg) + actorKeyUrl, err := urls.UrlProfileKey(handler.handlerCfg.Name, r.cfg.Domain) + if err != nil { + return err + } + + r.deliverAcceptToInbox(url, actorUrl, actorKeyUrl, follow, handler.handlerCfg) // subscribeActorToHandler() return nil }, func(c context.Context, note vocab.ActivityStreamsUndo) error { @@ -222,7 +227,7 @@ func (r *Registry) Inbox(name string, req *http.Request, payload []byte) error { return err } -func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.ActivityStreamsFollow, handler config.Handler) error { +func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, follow vocab.ActivityStreamsFollow, handler config.Handler) error { accept := streams.NewActivityStreamsAccept() actorProp := streams.NewActivityStreamsActorProperty() actorProp.AppendIRI(actorUrl) @@ -273,7 +278,7 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act ).Debugf("signing request") r.mu.Lock() - prefs := []httpsig.Algorithm{httpsig.RSA_SHA256} + 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"} @@ -285,7 +290,7 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act // ...but it is optional, no digest will be signed if given "nil" // body := nil // If r were a http.ResponseWriter, call SignResponse instead. - err = signer.SignRequest(privKey, actorUrl.String(), request, jsonData) + err = signer.SignRequest(privKey, actorKeyUrl.String(), request, jsonData) r.mu.Unlock() r.log.With( -- cgit v1.2.3