aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-05 16:40:35 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-05 16:40:35 +0000
commit80f545a71d24ebc6ffeedd421d161a83430608b1 (patch)
treed202dccf60dc5570b2c01732440d91102f93538d
parent1fc55f43cb2065f45a006e4ef6dd2dfc57ec4d00 (diff)
downloadcommunique-80f545a71d24ebc6ffeedd421d161a83430608b1.tar.gz
set keyurl
-rw-r--r--registry/registry.go13
1 files changed, 9 insertions, 4 deletions
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(