Documentation ¶
Index ¶
- func IsIdentifier(identifier string) (bool, error)
- func ParsePerson(ctx context.Context, actor vocab.Type) (vocab.ActivityStreamsPerson, error)
- type Actor
- type Client
- type Datastore
- type KeyGenerator
- type Person
- type PersonGenerator
- type PublicKey
- type RSAKeyGenerator
- type Server
- func (s *Server) GetAny(ctx context.Context, identifier string, statistics bool) (Actor, error)
- func (s *Server) GetAnyOutbox(ctx context.Context, identifier string, page int) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) GetEventInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetEventInboxPage(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) GetFollowers(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetFollowing(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetInboxAsOrderedCollection(ctx context.Context, username string, local bool) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetInboxPage(ctx context.Context, username, minID, maxID string, local bool) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) GetLikeStatus(ctx context.Context, actorID *url.URL, objectID *url.URL) (bool, error)
- func (s *Server) GetLikedAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetLocalPerson(ctx context.Context, username string, statistics bool) (vocab.Type, error)
- func (s *Server) GetNotificationsInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetNotificationsInboxPage(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) GetOutbox(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetOutboxPage(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) GetPublicInboxAsOrderedCollection(ctx context.Context, local, institute bool) (vocab.ActivityStreamsOrderedCollection, error)
- func (s *Server) GetPublicInboxPage(ctx context.Context, minID, maxID string, local, institute bool) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (s *Server) UpdateLocal(ctx context.Context, username, displayName, summary string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIdentifier ¶
IsIdentifier is of the form @username@domain then this function returns true.
func ParsePerson ¶
Types ¶
type Actor ¶
type Actor interface { vocab.Type GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty GetActivityStreamsFollowing() vocab.ActivityStreamsFollowingProperty GetActivityStreamsInbox() vocab.ActivityStreamsInboxProperty GetActivityStreamsOutbox() vocab.ActivityStreamsOutboxProperty }
type Client ¶
type Client interface { FetchRemoteActor(context.Context, string) (Actor, error) FetchObject(context.Context, *url.URL, bool, int, int) (vocab.Type, error) DereferenceFollowers(context.Context, vocab.ActivityStreamsFollowersProperty, int, int) error DereferenceFollowing(context.Context, vocab.ActivityStreamsFollowingProperty, int, int) error DereferenceOutbox(context.Context, vocab.ActivityStreamsOutboxProperty, int, int) error DereferenceObjectsInOrderedCollection(context.Context, vocab.ActivityStreamsOrderedCollection, int, int, int) (vocab.ActivityStreamsOrderedCollectionPage, error) DereferenceOrderedItems(context.Context, vocab.ActivityStreamsOrderedItemsProperty, int, int) error DereferenceItem(context.Context, vocab.Type, int, int) (vocab.Type, error) }
type Datastore ¶
type Datastore interface { GetActorByUsername(context.Context, string) (vocab.ActivityStreamsPerson, error) GetFollowersByUsername(context.Context, string) (vocab.ActivityStreamsOrderedCollection, error) GetFollowingByUsername(context.Context, string) (vocab.ActivityStreamsOrderedCollection, error) GetActorInbox(context.Context, string, string, string, bool) (vocab.ActivityStreamsOrderedCollectionPage, error) GetActorInboxAsOrderedCollection(context.Context, string, bool) (vocab.ActivityStreamsOrderedCollection, error) GetPublicInbox(context.Context, string, string, bool, bool) (vocab.ActivityStreamsOrderedCollectionPage, error) GetPublicInboxAsOrderedCollection(context.Context, bool, bool) (vocab.ActivityStreamsOrderedCollection, error) GetActorOutbox(context.Context, string, string, string) (vocab.ActivityStreamsOrderedCollectionPage, error) GetActorOutboxAsOrderedCollection(context.Context, string) (vocab.ActivityStreamsOrderedCollection, error) GetNotificationsInbox(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error) GetNotificationsInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error) GetEventInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error) GetEventInbox(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error) GetLikedAsOrderedCollection(context.Context, string) (vocab.ActivityStreamsOrderedCollection, error) GetLikeStatus(context.Context, *url.URL, *url.URL) (bool, error) UpdateActor(context.Context, string, string, string, vocab.ActivityStreamsImage) error }
type KeyGenerator ¶
type Person ¶
type Person vocab.ActivityStreamsPerson
Person is a type of Actor from https://www.w3.org/TR/activitypub/#actors.
type PersonGenerator ¶
type PersonGenerator struct { InstanceURL *url.URL KeyGenerator KeyGenerator }
func NewPersonGenerator ¶
func NewPersonGenerator(url *url.URL, keyGenerator KeyGenerator) *PersonGenerator
func (*PersonGenerator) GeneratePublicKey ¶
func (p *PersonGenerator) GeneratePublicKey(username string) (vocab.W3IDSecurityV1PublicKey, error)
type PublicKey ¶
type PublicKey vocab.W3IDSecurityV1PublicKey
type RSAKeyGenerator ¶
func NewRSAKeyGenerator ¶
func NewRSAKeyGenerator() *RSAKeyGenerator
func (*RSAKeyGenerator) GenerateKeyPair ¶
func (g *RSAKeyGenerator) GenerateKeyPair() (string, string, error)
func (*RSAKeyGenerator) GetPrivateKeyPEM ¶
func (g *RSAKeyGenerator) GetPrivateKeyPEM() ([]byte, error)
func (*RSAKeyGenerator) WritePrivateKey ¶
func (g *RSAKeyGenerator) WritePrivateKey(privateKeyPath string) error
type Server ¶
func (*Server) GetAny ¶
GetAny returns any ActivityPub actor based on the provided identifier. Uses Webfinger to determine the actor ID based on the identifier provided. If the statistics parameter is true then the number of Followers, Actors Followed, and the amount of Activities in the Outbox is returned.
func (*Server) GetAnyOutbox ¶
func (s *Server) GetAnyOutbox(ctx context.Context, identifier string, page int) (vocab.ActivityStreamsOrderedCollectionPage, error)
GetAnyOutbox fetches and dereferences any local or remote actor's outbox. The dereference page in the OrderedCollection is returned.
func (*Server) GetEventInboxAsOrderedCollection ¶
func (*Server) GetEventInboxPage ¶
func (*Server) GetFollowers ¶
func (s *Server) GetFollowers(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
GetFollowers returns an OrderedCollection where items are Actor IRIs.
func (*Server) GetFollowing ¶
func (s *Server) GetFollowing(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
GetFollowing returns an OrderedCollection where items are Actor IRIs.
func (*Server) GetInboxAsOrderedCollection ¶
func (s *Server) GetInboxAsOrderedCollection(ctx context.Context, username string, local bool) (vocab.ActivityStreamsOrderedCollection, error)
GetInboxAsOrderedCollection returns an OrderedCollection with page IRIs.
func (*Server) GetInboxPage ¶
func (s *Server) GetInboxPage(ctx context.Context, username, minID, maxID string, local bool) (vocab.ActivityStreamsOrderedCollectionPage, error)
GetInboxPage returns an OrderedCollectionPage with dereferenced objects.
func (*Server) GetLikeStatus ¶
func (s *Server) GetLikeStatus(ctx context.Context, actorID *url.URL, objectID *url.URL) (bool, error)
GetLikeStatus returns true if the Actor liked the Object ID.
func (*Server) GetLikedAsOrderedCollection ¶
func (s *Server) GetLikedAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
GetLikedAsOrderedCollection returns an OrderedCollection of Like IRIs.
func (*Server) GetLocalPerson ¶
func (s *Server) GetLocalPerson(ctx context.Context, username string, statistics bool) (vocab.Type, error)
GetLocalPerson returns the ActivityPub actor with the corresponding username. If the statistics parameter is true then the number of Followers, Actors Followed, and the amount of Activities in the Outbox is returned.
func (*Server) GetNotificationsInboxAsOrderedCollection ¶
func (*Server) GetNotificationsInboxPage ¶
func (*Server) GetOutbox ¶
func (s *Server) GetOutbox(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)
GetOutbox returns an OrderedCollection with IRIs.
func (*Server) GetOutboxPage ¶
func (s *Server) GetOutboxPage(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)
GetOutboxPage returns an OrderedCollectionPage with objects.
func (*Server) GetPublicInboxAsOrderedCollection ¶
func (s *Server) GetPublicInboxAsOrderedCollection(ctx context.Context, local, institute bool) (vocab.ActivityStreamsOrderedCollection, error)
GetPublicInboxAsOrderedCollection returns an OrderedCollection with IRIs.
func (*Server) GetPublicInboxPage ¶
func (s *Server) GetPublicInboxPage(ctx context.Context, minID, maxID string, local, institute bool) (vocab.ActivityStreamsOrderedCollectionPage, error)
GetPublicInboxPage returns an OrderedCollectionPage with objects.
func (*Server) UpdateLocal ¶
func (s *Server) UpdateLocal(ctx context.Context, username, displayName, summary string, file multipart.File, header *multipart.FileHeader) error
UpdateLocal updates the internal representation of the actor. The mutable properties are the "name", "summary", and "icon". Handles directory creation and file naming.