agent

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package agent provides a reference implementation for a DID network management process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler provides the required functionality for the DID method.

func NewHandler

func NewHandler(options HandlerOptions) (*Handler, error)

NewHandler starts a new DID method handler instance.

func (*Handler) AccountActivity

func (h *Handler) AccountActivity(ctx context.Context, req *protoV1.AccountActivityRequest) (<-chan *protoV1.AccountActivityResponse, error)

AccountActivity opens a channel to monitor near real-time account activity. The channel must be closed using the provided context when no longer needed.

func (*Handler) AccountInformation

AccountInformation returns details about the crypto account specified.

func (*Handler) Close

func (h *Handler) Close() error

Close the instance and safely terminate any internal processing.

func (*Handler) GatewaySetup added in v0.3.0

func (h *Handler) GatewaySetup() rpc.GatewayRegisterFunc

GatewaySetup return the HTTP setup method to allow exposing the handler's functionality through an HTTP gateway.

func (*Handler) Process

func (h *Handler) Process(req *protoV1.ProcessRequest) (string, error)

Process an incoming request ticket.

func (*Handler) QueryResponseFilter

func (h *Handler) QueryResponseFilter() rpc.GatewayInterceptor

QueryResponseFilter provides custom encoding of HTTP query results.

func (*Handler) Retrieve

func (h *Handler) Retrieve(req *protoV1.QueryRequest) (*did.Identifier, *did.ProofLD, error)

Retrieve an existing DID instance based on its subject string.

func (*Handler) ServerSetup added in v0.3.0

func (h *Handler) ServerSetup(server *grpc.Server)

ServerSetup performs all initialization requirements for the handler instance to be exposed through the provided gRPC server.

func (*Handler) TxParameters

func (h *Handler) TxParameters(ctx context.Context) (*protoV1.TxParametersResponse, error)

TxParameters return the latest network parameters suggested for processing new transactions.

func (*Handler) TxSubmit

TxSubmit will send a signed raw transaction to the network for processing.

type HandlerOptions

type HandlerOptions struct {
	// Supported DID methods.
	Methods []string

	// PoW difficulty level required for valid transactions.
	Difficulty uint

	// Storage mechanism to be used for persistent state.
	Store Storage

	// Observability operator.
	OOP *otel.Operator

	// Algorand node client.
	AlgoNode *algod.Client

	// Algorand indexer client.
	AlgoIndexer *indexer.Client
}

HandlerOptions defines the settings available to adjust the operation of a handler instance.

type Storage

type Storage interface {
	// Setup the instance and prepare for usage.
	Open(info string) error

	// Free resources and finish processing.
	Close() error

	// Returns a brief information summary for the storage instance.
	Description() string

	// Check if a record exists for the specified DID.
	Exists(id *did.Identifier) bool

	// Return a previously stored DID instance.
	Get(req *protoV1.QueryRequest) (*did.Identifier, *did.ProofLD, error)

	// Create or update the record for the given DID instance.
	Save(id *did.Identifier, proof *did.ProofLD) (string, error)

	// Remove any existing records for the given DID instance.
	Delete(id *did.Identifier) error
}

Storage defines an abstract component that provides and manage persistent data requirements for DID documents.

Directories

Path Synopsis
Package storage includes sample implementations of different store mechanisms.
Package storage includes sample implementations of different store mechanisms.

Jump to

Keyboard shortcuts

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