Documentation ¶
Index ¶
- Variables
- type AcceptFollowHandler
- type AcceptList
- type ActivityHandler
- type ActorAuth
- type AnchorEventAcknowledgementHandler
- type AnchorHandler
- type HandlerOpt
- func WithAcceptFollowHandler(handler AcceptFollowHandler) HandlerOpt
- func WithAnchorEventAcknowledgementHandler(handler AnchorEventAcknowledgementHandler) HandlerOpt
- func WithAnchorEventHandler(handler AnchorHandler) HandlerOpt
- func WithFollowAuth(handler ActorAuth) HandlerOpt
- func WithInviteWitnessAuth(handler ActorAuth) HandlerOpt
- func WithProofHandler(handler ProofHandler) HandlerOpt
- func WithUndoFollowHandler(handler UndoFollowHandler) HandlerOpt
- func WithWitness(handler WitnessHandler) HandlerOpt
- type Handlers
- type Inbox
- type InboxHandler
- type Outbox
- type ProofHandler
- type ServiceLifecycle
- type UndeliverableActivityHandler
- type UndoFollowHandler
- type WitnessHandler
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicateAnchorEvent = errors.New("anchor event already handled")
ErrDuplicateAnchorEvent indicates that the anchor event was already processed by the InboxHandler.
Functions ¶
This section is empty.
Types ¶
type AcceptFollowHandler ¶ added in v1.0.0
AcceptFollowHandler handles accepting follow request.
type AcceptList ¶ added in v1.0.0
AcceptList contains the URIs that are to be accepted by an authorization handler for the given type. Known types are "follow" and "invite-witness".
type ActivityHandler ¶
type ActivityHandler interface { ServiceLifecycle // HandleActivity handles the ActivityPub activity. An optional source may be added // to indicate where the activity was retrieved from. HandleActivity(ctx context.Context, source *url.URL, activity *vocab.ActivityType) error // Subscribe allows a client to receive published activities. Subscribe() <-chan *vocab.ActivityType }
ActivityHandler defines the functions of an Activity handler.
type ActorAuth ¶
ActorAuth makes the decision of whether a request by the given actor should be accepted.
type AnchorEventAcknowledgementHandler ¶ added in v0.1.3
type AnchorEventAcknowledgementHandler interface { AnchorEventAcknowledged(actor, anchorRef *url.URL, additionalAnchorRefs []*url.URL) error UndoAnchorEventAcknowledgement(actor, anchorRef *url.URL, additionalAnchorRefs []*url.URL) error }
AnchorEventAcknowledgementHandler handles notification of a successful anchor event processed from an Orb server, as well as undoing a previously acknowledged anchor event.
type AnchorHandler ¶ added in v1.0.0
type AnchorHandler interface {
HandleAnchorEvent(ctx context.Context, actor, anchorEventRef, source *url.URL, anchorEvent *vocab.AnchorEventType) error
}
AnchorHandler handles a new, published anchor event.
type HandlerOpt ¶
type HandlerOpt func(options *Handlers)
HandlerOpt sets a specific handler.
func WithAcceptFollowHandler ¶ added in v1.0.0
func WithAcceptFollowHandler(handler AcceptFollowHandler) HandlerOpt
WithAcceptFollowHandler sets accept follow handler.
func WithAnchorEventAcknowledgementHandler ¶ added in v0.1.3
func WithAnchorEventAcknowledgementHandler(handler AnchorEventAcknowledgementHandler) HandlerOpt
WithAnchorEventAcknowledgementHandler sets the handler for an acknowledgement of a successful anchor event that was processed by another Orb server.
func WithAnchorEventHandler ¶ added in v1.0.0
func WithAnchorEventHandler(handler AnchorHandler) HandlerOpt
WithAnchorEventHandler sets the handler for the published anchor event.
func WithFollowAuth ¶ added in v1.0.0
func WithFollowAuth(handler ActorAuth) HandlerOpt
WithFollowAuth sets the handler that decides whether or not to accept a 'Follow' request.
func WithInviteWitnessAuth ¶ added in v1.0.0
func WithInviteWitnessAuth(handler ActorAuth) HandlerOpt
WithInviteWitnessAuth sets the handler that decides whether or not to accept an 'InviteWitness' request.
func WithProofHandler ¶
func WithProofHandler(handler ProofHandler) HandlerOpt
WithProofHandler sets the proof handler.
func WithUndoFollowHandler ¶ added in v1.0.0
func WithUndoFollowHandler(handler UndoFollowHandler) HandlerOpt
WithUndoFollowHandler sets undo follow handler.
func WithWitness ¶
func WithWitness(handler WitnessHandler) HandlerOpt
WithWitness sets the witness handler.
type Handlers ¶
type Handlers struct { AnchorHandler AnchorHandler FollowerAuth ActorAuth WitnessInvitationAuth ActorAuth Witness WitnessHandler ProofHandler ProofHandler AnchorAckHandler AnchorEventAcknowledgementHandler AcceptFollowHandler AcceptFollowHandler UndoFollowHandler UndoFollowHandler }
Handlers contains handlers for various activity events, including undeliverable activities.
type Inbox ¶
type Inbox interface { ServiceLifecycle }
Inbox defines the functions for an ActivityPub inbox.
type InboxHandler ¶ added in v1.0.0
type InboxHandler interface { HandleCreateActivity(ctx context.Context, source *url.URL, create *vocab.ActivityType, announce bool) error HandleAnnounceActivity(ctx context.Context, source *url.URL, create *vocab.ActivityType) (numProcessed int, err error) }
InboxHandler defines functions for handling Create and Announce activities.
type Outbox ¶
type Outbox interface { ServiceLifecycle // Post posts an activity to the outbox and returns the ID of the activity. Post(ctx context.Context, activity *vocab.ActivityType, exclude ...*url.URL) (*url.URL, error) }
Outbox defines the functions for an ActivityPub outbox.
type ProofHandler ¶
type ProofHandler interface {
HandleProof(ctx context.Context, witness *url.URL, anchorID string, endTime time.Time, proof []byte) error
}
ProofHandler handles the given proof for the anchor credential.
type ServiceLifecycle ¶
type ServiceLifecycle interface { // Start starts the service. Start() // Stop stops the service. Stop() // State returns the state of the service. State() lifecycle.State }
ServiceLifecycle defines the functions of a service lifecycle.
type UndeliverableActivityHandler ¶
type UndeliverableActivityHandler interface {
HandleUndeliverableActivity(activity *vocab.ActivityType, toURL string)
}
UndeliverableActivityHandler handles undeliverable activities.
type UndoFollowHandler ¶ added in v1.0.0
UndoFollowHandler reverses follow request.
type WitnessHandler ¶
WitnessHandler is a handler that witnesses an anchor credential.