spi

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

type ActorAuth interface {
	AuthorizeActor(actor *vocab.ActorType) (bool, error)
}

ActorAuth makes the decision of whether or not a request by the given actor should be accepted.

type AnchorCredentialHandler

type AnchorCredentialHandler interface {
	HandleAnchorCredential(actor, id *url.URL, cid string, anchorCred []byte) error
}

AnchorCredentialHandler handles a new, published anchor credential.

type AnchorEventAcknowledgementHandler added in v0.1.3

type AnchorEventAcknowledgementHandler interface {
	AnchorEventAcknowledged(actor, anchorRef *url.URL, additionalAnchorRefs []*url.URL) error
}

AnchorEventAcknowledgementHandler handles notification of a successful anchor event processed from an Orb server.

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 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 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
	AnchorEventAckHandler   AnchorEventAcknowledgementHandler
}

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, 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 WitnessHandler

type WitnessHandler interface {
	Witness(anchorCred []byte) ([]byte, error)
}

WitnessHandler is a handler that witnesses an anchor credential.

Jump to

Keyboard shortcuts

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