defaultservice

package
v0.0.0-...-2c2efe1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package defaultservice - Service that Milagro D-TA provides with no-plugins

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugable

type Plugable interface {
	// service
	Name() string
	Vendor() string

	// order
	ValidateOrderRequest(req *api.OrderRequest) error
	ValidateOrderSecretRequest(req *api.OrderSecretRequest, order documents.OrderDoc) error
	PrepareOrderPart1(order *documents.OrderDoc, reqExtension map[string]string) (fulfillExtension map[string]string, err error)
	PrepareOrderResponse(orderPart2 *documents.OrderDoc, reqExtension, fulfillExtension map[string]string) (commitment string, extension map[string]string, err error)
	ProduceBeneficiaryEncryptedData(blsSK []byte, order *documents.OrderDoc, req *api.OrderSecretRequest) (encrypted []byte, extension map[string]string, err error)
	ProduceFinalSecret(seed, sikeSK []byte, order, orderPart4 *documents.OrderDoc, req *api.OrderSecretRequest, fulfillSecretRespomse *api.FulfillOrderSecretResponse) (secret, commitment string, extension map[string]string, err error)
}

Plugable service methods

type Service

type Service struct {
	Plugin                Plugable
	Logger                *logger.Logger
	Rng                   io.Reader
	Store                 *datastore.Store
	KeyStore              keystore.Store
	Ipfs                  ipfs.Connector
	MasterFiduciaryServer api.ClientService
	// contains filtered or unexported fields
}

Service implements the default functionality It also implements the ServicePlugin interface

func NewService

func NewService() *Service

NewService returns a default implementation of Service

func (*Service) Endpoints

func (s *Service) Endpoints() (namespace string, endpoints transport.HTTPEndpoints)

Endpoints for extending the plugin endpoints

func (*Service) FulfillOrder

func (s *Service) FulfillOrder(req *api.FulfillOrderRequest) (*api.FulfillOrderResponse, error)

FulfillOrder -

func (*Service) FulfillOrderSecret

func (s *Service) FulfillOrderSecret(req *api.FulfillOrderSecretRequest) (*api.FulfillOrderSecretResponse, error)

FulfillOrderSecret -

func (*Service) GetOrder

func (s *Service) GetOrder(req *api.GetOrderRequest) (*api.GetOrderResponse, error)

GetOrder retreives an order

func (*Service) Init

func (s *Service) Init(plugin Plugable, options ...ServiceOption) error

Init sets-up the service options. It's called when the plugin gets registered

func (*Service) MasterFiduciaryNodeID

func (s *Service) MasterFiduciaryNodeID() string

MasterFiduciaryNodeID returns the Master Fiduciary NodeID

func (*Service) Name

func (s *Service) Name() string

Name of the plugin

func (*Service) NodeID

func (s *Service) NodeID() string

NodeID returns the node CID

func (*Service) Order

func (s *Service) Order(req *api.OrderRequest) (*api.OrderResponse, error)

Order -

func (*Service) OrderList

func (s *Service) OrderList(req *api.OrderListRequest) (*api.OrderListResponse, error)

OrderList retrieves the list of orders

func (*Service) OrderSecret

func (s *Service) OrderSecret(req *api.OrderSecretRequest) (*api.OrderSecretResponse, error)

OrderSecret -

func (*Service) PrepareOrderPart1

func (s *Service) PrepareOrderPart1(order *documents.OrderDoc, reqExtension map[string]string) (fulfillExtension map[string]string, err error)

PrepareOrderPart1 is called before the order is send

func (*Service) PrepareOrderResponse

func (s *Service) PrepareOrderResponse(orderPart2 *documents.OrderDoc, reqExtension, fulfillExtension map[string]string) (commitment string, extension map[string]string, err error)

PrepareOrderResponse gets the updated order and returns the commitment and extension

func (*Service) ProduceBeneficiaryEncryptedData

func (s *Service) ProduceBeneficiaryEncryptedData(blsSK []byte, order *documents.OrderDoc, req *api.OrderSecretRequest) (encrypted []byte, extension map[string]string, err error)

ProduceBeneficiaryEncryptedData -

func (*Service) ProduceFinalSecret

func (s *Service) ProduceFinalSecret(seed, sikeSK []byte, order, orderPart4 *documents.OrderDoc, req *api.OrderSecretRequest, fulfillSecretRespomse *api.FulfillOrderSecretResponse) (secret, commitment string, extension map[string]string, err error)

ProduceFinalSecret -

func (*Service) SetMasterFiduciaryNodeID

func (s *Service) SetMasterFiduciaryNodeID(masterFiduciaryNodeID string)

SetMasterFiduciaryNodeID sets the Master Fiduciary NodeID

func (*Service) SetNodeID

func (s *Service) SetNodeID(nodeID string)

SetNodeID sets the Node CID

func (*Service) Status

func (s *Service) Status(apiVersion, nodeType string) (*api.StatusResponse, error)

Status of the server

func (*Service) ValidateOrderRequest

func (s *Service) ValidateOrderRequest(req *api.OrderRequest) error

ValidateOrderRequest returns error if the request values are invalid

func (*Service) ValidateOrderSecretRequest

func (s *Service) ValidateOrderSecretRequest(req *api.OrderSecretRequest, order documents.OrderDoc) error

ValidateOrderSecretRequest - Validate fields in the Order Secret

func (*Service) Vendor

func (s *Service) Vendor() string

Vendor of the plugin

type ServiceOption

type ServiceOption func(s *Service) error

ServiceOption function to set Service properties

func WithConfig

func WithConfig(cfg *config.Config) ServiceOption

WithConfig adds config settings to the Service

func WithDataStore

func WithDataStore(store *datastore.Store) ServiceOption

WithDataStore adds store to the Service

func WithIPFS

func WithIPFS(ipfsConnector ipfs.Connector) ServiceOption

WithIPFS adds ipfs connector to the Service

func WithKeyStore

func WithKeyStore(store keystore.Store) ServiceOption

WithKeyStore adds store to the Service

func WithLogger

func WithLogger(logger *logger.Logger) ServiceOption

WithLogger adds logger to the Service

func WithMasterFiduciary

func WithMasterFiduciary(masterFiduciaryServer api.ClientService) ServiceOption

WithMasterFiduciary adds master fiduciary connector to the Service

func WithRng

func WithRng(rng io.Reader) ServiceOption

WithRng adds rng to the Service

Jump to

Keyboard shortcuts

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