Documentation ¶
Index ¶
- Constants
- type AcceptAllActorsAuth
- type AcceptListAuthHandler
- type Config
- type Inbox
- func (h *Inbox) HandleActivity(source *url.URL, activity *vocab.ActivityType) error
- func (h *Inbox) HandleAnnounceActivity(source *url.URL, announce *vocab.ActivityType) (numProcessed int, err error)
- func (h *Inbox) HandleCreateActivity(source *url.URL, create *vocab.ActivityType, announce bool) error
- func (h Inbox) Subscribe() <-chan *vocab.ActivityType
- type Outbox
Constants ¶
const ( // FollowType defines the 'follow' accept list type. FollowType = "follow" // InviteWitnessType defines the 'invite-witness' accept list type. InviteWitnessType = "invite-witness" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptAllActorsAuth ¶
type AcceptAllActorsAuth struct{}
AcceptAllActorsAuth is an authorization handler that accepts any actor.
func (*AcceptAllActorsAuth) AuthorizeActor ¶
func (a *AcceptAllActorsAuth) AuthorizeActor(*vocab.ActorType) (bool, error)
AuthorizeActor authorizes the actor. This implementation always returns true.
type AcceptListAuthHandler ¶
type AcceptListAuthHandler struct {
// contains filtered or unexported fields
}
AcceptListAuthHandler implements an authorization handler that looks up an actor URI from an 'accept list'. If the actor URI is included in the accept list then the request is approved, otherwise it is denied.
func NewAcceptListAuthHandler ¶
func NewAcceptListAuthHandler(allowType string, mgr acceptListMgr) *AcceptListAuthHandler
NewAcceptListAuthHandler returns a new accept list authorization handler.
func (*AcceptListAuthHandler) AuthorizeActor ¶
func (h *AcceptListAuthHandler) AuthorizeActor(actor *vocab.ActorType) (bool, error)
AuthorizeActor return true if the given actor is authorized.
type Config ¶
type Config struct { // ServiceName is the name of the service (used for logging). ServiceName string // ServiceIRI is the IRI of the local service (actor). It is used as the 'actor' in activities // that are posted to the outbox by the handler. This IRI may be an HTTP(s) address or a DID. ServiceIRI *url.URL // ServiceEndpointURL is the HTTP(s) endpoint of the service (actor). ServiceEndpointURL *url.URL // BufferSize is the size of the Go channel buffer for a subscription. BufferSize int // MaxWitnessDelay is the maximum delay from when the witness receives the transaction (via an Offer) for // the witness to include the transaction into the ledger. MaxWitnessDelay time.Duration }
Config holds the configuration parameters for the activity handler.
type Inbox ¶
Inbox handles activities posted to the inbox.
func NewInbox ¶
func NewInbox(cfg *Config, s store.Store, outbox service.Outbox, activityPubClient activityPubClient, opts ...service.HandlerOpt) *Inbox
NewInbox returns a new ActivityPub inbox activity handler.
func (*Inbox) HandleActivity ¶
HandleActivity handles the ActivityPub activity in the inbox.
func (*Inbox) HandleAnnounceActivity ¶
func (h *Inbox) HandleAnnounceActivity(source *url.URL, announce *vocab.ActivityType) (numProcessed int, err error)
HandleAnnounceActivity handles an 'Announce' ActivityPub activity.
func (*Inbox) HandleCreateActivity ¶
func (h *Inbox) HandleCreateActivity(source *url.URL, create *vocab.ActivityType, announce bool) error
HandleCreateActivity handles a 'Create' ActivityPub activity.
func (Inbox) Subscribe ¶
func (h Inbox) Subscribe() <-chan *vocab.ActivityType
Subscribe allows a client to receive published activities.
type Outbox ¶
type Outbox struct {
// contains filtered or unexported fields
}
Outbox handles activities posted to the outbox.
func (*Outbox) HandleActivity ¶
HandleActivity handles the ActivityPub activity in the outbox.
func (Outbox) Subscribe ¶
func (h Outbox) Subscribe() <-chan *vocab.ActivityType
Subscribe allows a client to receive published activities.