Commit Diff


commit - 96b56ad384e99eb42c0c18ba1321d3c9a0d74c1c
commit + 186ac3bf2ba1c6ae3e5844233d7162521e2c79ed
blob - 394107211718e1725e4598c31f9e1b2d8b3fb3bf
blob + bb80245967fe7db2893da97b3b9446a9b94bdec7
--- apub.go
+++ apub.go
@@ -16,8 +16,13 @@ import (
 	"time"
 )
 
-// @context
-const AtContext string = "https://www.w3.org/ns/activitystreams"
+// NormContext is a URL referencing the
+// normative Activity Streams 2.0 JSON-LD @context definition.
+// All [Activity] variables should have their AtContext field set to this value.
+// See [Activity Streams 2.0] section 2.1.
+//
+// [Activity Streams 2.0]: https://www.w3.org/TR/activitystreams-core/
+const NormContext string = "https://www.w3.org/ns/activitystreams"
 
 // ContentType is the MIME media type for ActivityPub.
 const ContentType string = "application/activity+json"
@@ -30,6 +35,8 @@ const PublicCollection string = "https://www.w3.org/ns
 
 var ErrNotExist = errors.New("no such activity")
 
+// Activity represents the Activity Streams Object core type.
+// See Activity Streams 2.0, section 4.1.
 type Activity struct {
 	AtContext    string     `json:"@context"`
 	ID           string     `json:"id"`
@@ -56,6 +63,9 @@ type Activity struct {
 	Audience  string          `json:"audience,omitempty"`
 	Href      string          `json:"href,omitempty"`
 	Tag       []Activity      `json:"tag,omitempty"`
+	// Contains a JSON-encoded Activity, or a URL as a JSON string
+	// pointing to an Activity. Use Activity.Unwrap() to access
+	// the enclosed, decoded value.
 	Object    json.RawMessage `json:"object,omitempty"`
 }
 
blob - 8aa85921ec7f83e153d9158bee7c546bc60713f2
blob + b1a14b6385df6197b110d7a1955b29bae60507b5
--- internal/sys/user.go
+++ internal/sys/user.go
@@ -54,7 +54,7 @@ func Actor(name, host string) (*apub.Actor, error) {
 		return nil, fmt.Errorf("read public key file: %w", err)
 	}
 	return &apub.Actor{
-		AtContext: apub.AtContext,
+		AtContext: apub.NormContext,
 		ID:        root + "/actor.json",
 		Type:      "Person",
 		Name:      u.Name,
blob - bed76fae19b3fa04905356980c77324b465eb3ae
blob + c6912852868287f8120ed9ccadf48ce62e7f59d2
--- mail.go
+++ mail.go
@@ -133,7 +133,7 @@ func UnmarshalMail(msg *mail.Message) (*Activity, erro
 	}
 
 	return &Activity{
-		AtContext:    AtContext,
+		AtContext:    NormContext,
 		Type:         "Note",
 		AttributedTo: wfrom.ID,
 		To:           wto,