activityhandler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
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 added in v1.0.0

type AcceptAllActorsAuth struct{}

AcceptAllActorsAuth is an authorization handler that accepts any actor.

func (*AcceptAllActorsAuth) AuthorizeActor added in v1.0.0

func (a *AcceptAllActorsAuth) AuthorizeActor(*vocab.ActorType) (bool, error)

AuthorizeActor authorizes the actor. This implementation always returns true.

type AcceptListAuthHandler added in v1.0.0

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 added in v1.0.0

func NewAcceptListAuthHandler(allowType string, mgr acceptListMgr) *AcceptListAuthHandler

NewAcceptListAuthHandler returns a new accept list authorization handler.

func (*AcceptListAuthHandler) AuthorizeActor added in v1.0.0

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

type Inbox struct {
	*service.Handlers
	// contains filtered or unexported fields
}

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

func (h *Inbox) HandleActivity(ctx context.Context, source *url.URL, activity *vocab.ActivityType) error

HandleActivity handles the ActivityPub activity in the inbox.

func (*Inbox) HandleAnnounceActivity added in v1.0.0

func (h *Inbox) HandleAnnounceActivity(ctx context.Context, source *url.URL, announce *vocab.ActivityType) (numProcessed int, err error)

HandleAnnounceActivity handles an 'Announce' ActivityPub activity.

func (*Inbox) HandleCreateActivity added in v1.0.0

func (h *Inbox) HandleCreateActivity(ctx context.Context, 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 NewOutbox

func NewOutbox(cfg *Config, s store.Store, activityPubClient activityPubClient) *Outbox

NewOutbox returns a new ActivityPub outbox activity handler.

func (*Outbox) HandleActivity

func (h *Outbox) HandleActivity(ctx context.Context, source *url.URL, activity *vocab.ActivityType) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL