aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--views/actor.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/views/actor.go b/views/actor.go
index a91044a..48aaa0b 100644
--- a/views/actor.go
+++ b/views/actor.go
@@ -7,7 +7,7 @@ import (
"github.com/go-fed/activity/streams"
)
-func RenderActor(name, domain string) (map[string]interface{}, error) {
+func RenderActor(name, domain, pem string) (map[string]interface{}, error) {
inbox, err := urls.UrlInbox(name, domain)
if err != nil {
return nil, err
@@ -29,6 +29,11 @@ func RenderActor(name, domain string) (map[string]interface{}, error) {
return nil, err
}
+ actorUrlKey, err := urls.UrlProfileKey(name, domain)
+ if err != nil {
+ return nil, err
+ }
+
followingUrl, err := urls.UrlFollowing(name, domain)
if err != nil {
return nil, err
@@ -70,5 +75,23 @@ func RenderActor(name, domain string) (map[string]interface{}, error) {
followingProp.SetIRI(followingUrl)
p.SetActivityStreamsFollowing(followingProp)
+ pemProp := streams.NewW3IDSecurityV1PublicKeyPemProperty()
+ pemProp.Set(pem)
+
+ ownerProp := streams.NewW3IDSecurityV1OwnerProperty()
+ ownerProp.Set(actorUrl)
+
+ pubkeyId := streams.NewJSONLDIdProperty()
+ pubkeyId.Set(actorUrlKey)
+
+ pubKey := streams.NewW3IDSecurityV1PublicKey()
+ pubKey.SetW3IDSecurityV1PublicKeyPem(pemProp)
+ pubKey.SetW3IDSecurityV1Owner(ownerProp)
+ pubKey.SetJSONLDId(pubkeyId)
+
+ pubKeyProp := streams.NewW3IDSecurityV1PublicKeyProperty()
+ pubKeyProp.AppendW3IDSecurityV1PublicKey(pubKey)
+ p.SetW3IDSecurityV1PublicKey(pubKeyProp)
+
return streams.Serialize(p)
}