Documentation ¶
Overview ¶
apub is an implementation of the ActivityPub protocol.
https://www.w3.org/TR/activitypub/ https://www.w3.org/TR/activitystreams-core/ https://www.w3.org/TR/activitystreams-vocabulary/
Index ¶
Constants ¶
const ContentType string = "application/activity+json"
ContentType is the MIME media type for ActivityPub.
const NormContext 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.
const PublicCollection string = "https://www.w3.org/ns/activitystreams#Public"
PublicCollection is the ActivityPub ID for the special collection indicating public access. Any Activity addressed to this collection is meant to be available to all users, authenticated or not. See W3C Recommendation ActivityPub Section 5.6.
Variables ¶
DocFS contains the apas overview documentation to be served by http.FileServer.
Functions ¶
func SendMail ¶
Types ¶
type Activity ¶
type Activity struct { AtContext string `json:"@context"` ID string `json:"id"` Type string `json:"type"` Name string `json:"name,omitempty"` Actor string `json:"actor,omitempty"` Username string `json:"preferredUsername,omitempty"` Summary string `json:"summary,omitempty"` Inbox string `json:"inbox,omitempty"` Outbox string `json:"outbox,omitempty"` To []string `json:"to,omitempty"` CC []string `json:"cc,omitempty"` Followers string `json:"followers,omitempty"` InReplyTo string `json:"inReplyTo,omitempty"` Published *time.Time `json:"published,omitempty"` AttributedTo string `json:"attributedTo,omitempty"` Content string `json:"content,omitempty"` MediaType string `json:"mediaType,omitempty"` Source struct { Content string `json:"content,omitempty"` MediaType string `json:"mediaType,omitempty"` } `json:"source,omitempty"` PublicKey *PublicKey `json:"publicKey,omitempty"` 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"` }
Activity represents the Activity Streams Object core type. See Activity Streams 2.0, section 4.1.
type Actor ¶
type Actor struct { AtContext string `json:"@context"` ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Username string `json:"preferredUsername"` Summary string `json:"summary,omitempty"` Inbox string `json:"inbox"` Outbox string `json:"outbox"` Followers string `json:"followers"` Published *time.Time `json:"published,omitempty"` PublicKey PublicKey `json:"publicKey"` }
func Finger ¶
Finger is convenience function returning the corresponding Actor, if any, of an address resolvable by WebFinger. It is equivalent to doing webfinger.Lookup then LookupActor.
func (*Actor) Address ¶
Address generates the most likely address of the Actor. The Actor's name (not the username) is used as the address' proper name, if present. Implementors should verify the address using WebFinger. For example, the followers address for Actor ID https://hachyderm.io/users/otl is:
"Oliver Lowe" <otl+followers@hachyderm.io>
func (*Actor) FollowersAddress ¶
FollowersAddress generates a non-standard address representing the Actor's followers using plus addressing. It is the Actor's address username part with a "+followers" suffix. The address cannot be resolved using WebFinger.
For example, the followers address for Actor ID https://hachyderm.io/users/otl is:
"Oliver Lowe (followers)" <otl+followers@hachyderm.io>