Documentation ¶
Index ¶
- Constants
- Variables
- type ActivityHandler
- type ActorAuth
- type AnchorCredentialHandler
- type HandlerOpt
- func WithAnchorCredentialHandler(handler AnchorCredentialHandler) HandlerOpt
- func WithFollowerAuth(handler ActorAuth) HandlerOpt
- func WithProofHandler(handler ProofHandler) HandlerOpt
- func WithUndeliverableHandler(handler UndeliverableActivityHandler) HandlerOpt
- func WithWitness(handler WitnessHandler) HandlerOpt
- func WithWitnessInvitationAuth(handler ActorAuth) HandlerOpt
- type Handlers
- type Inbox
- type Outbox
- type ProofHandler
- type ServiceLifecycle
- type State
- type UndeliverableActivityHandler
- type WitnessHandler
Constants ¶
const UndeliverableTopic = "undeliverable"
UndeliverableTopic is the topic to which to post undeliverable messages.
Variables ¶
var ErrNotStarted = errors.New("service has not started")
ErrNotStarted indicates that an attempt was made to invoke a service that has not been started or is still in the process of starting.
Functions ¶
This section is empty.
Types ¶
type ActivityHandler ¶
type ActivityHandler interface { ServiceLifecycle // HandleActivity handles the ActivityPub activity. HandleActivity(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 or not a request by the given actor should be accepted.
type AnchorCredentialHandler ¶
type AnchorCredentialHandler interface {
HandleAnchorCredential(id *url.URL, cid string, anchorCred []byte) error
}
AnchorCredentialHandler handles a new, published anchor credential.
type HandlerOpt ¶
type HandlerOpt func(options *Handlers)
HandlerOpt sets a specific handler.
func WithAnchorCredentialHandler ¶
func WithAnchorCredentialHandler(handler AnchorCredentialHandler) HandlerOpt
WithAnchorCredentialHandler sets the handler for the published anchor credentials.
func WithFollowerAuth ¶
func WithFollowerAuth(handler ActorAuth) HandlerOpt
WithFollowerAuth sets the handler that decides whether or not to accept a 'Follow' request.
func WithProofHandler ¶
func WithProofHandler(handler ProofHandler) HandlerOpt
WithProofHandler sets the proof handler.
func WithUndeliverableHandler ¶
func WithUndeliverableHandler(handler UndeliverableActivityHandler) HandlerOpt
WithUndeliverableHandler sets the handler that's called when an activity can't be delivered.
func WithWitness ¶
func WithWitness(handler WitnessHandler) HandlerOpt
WithWitness sets the witness handler.
func WithWitnessInvitationAuth ¶
func WithWitnessInvitationAuth(handler ActorAuth) HandlerOpt
WithWitnessInvitationAuth sets the handler that decides whether or not to accept an 'InviteWitness' request.
type Handlers ¶
type Handlers struct { UndeliverableHandler UndeliverableActivityHandler AnchorCredentialHandler AnchorCredentialHandler FollowerAuth ActorAuth WitnessInvitationAuth ActorAuth Witness WitnessHandler ProofHandler ProofHandler }
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 Outbox ¶
type Outbox interface { ServiceLifecycle // Post posts an activity to the outbox and returns the ID of the activity. Post(activity *vocab.ActivityType) (*url.URL, error) }
Outbox defines the functions for an ActivityPub outbox.
type ProofHandler ¶
type ProofHandler interface {
HandleProof(witness *url.URL, anchorCredID string, startTime time.Time, 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() State }
ServiceLifecycle defines the functions of a service lifecycle.
type State ¶
type State = uint32
State is the state of the service.
const ( // StateNotStarted indicates that the service has not been started. StateNotStarted State = 0 // StateStarting indicates that the service is in the process of starting. StateStarting State = 1 // StateStarted indicates that the service has been started. StateStarted State = 2 // StateStopped indicates that the service has been stopped. StateStopped State = 3 )
type UndeliverableActivityHandler ¶
type UndeliverableActivityHandler interface {
HandleUndeliverableActivity(activity *vocab.ActivityType, toURL string)
}
UndeliverableActivityHandler handles undeliverable activities.
type WitnessHandler ¶
WitnessHandler is a handler that witnesses an anchor credential.