server

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalCommand

func UnmarshalCommand(raw []byte) (*token.Command, error)

UnmarshalCommand unmarshal token.Command messages

Types

type Issuer

type Issuer interface {
	// Issue creates an import request transaction.
	RequestImport(tokensToIssue []*token.TokenToIssue) (*token.TokenTransaction, error)
}

An Issuer creates token import requests.

type Marshaler

type Marshaler interface {
	MarshalCommandResponse(command []byte, responsePayload interface{}) (*token.SignedCommandResponse, error)
}

A Marshaler is responsible for marshaling and signging command responses.

type PolicyBasedAccessControl

type PolicyBasedAccessControl struct {
	SignedDataPolicyChecker SignedDataPolicyChecker
}

PolicyBasedAccessControl implements token command access control functions.

func (*PolicyBasedAccessControl) Check

type PolicyChecker

type PolicyChecker interface {
	Check(sc *token.SignedCommand, c *token.Command) error
}

A PolicyChecker is responsible for performing policy based access control checks related to token commands.

type Prover

type Prover struct {
	Marshaler     Marshaler
	PolicyChecker PolicyChecker
	TMSManager    TMSManager
}

A Provider is responslble for processing token commands.

func (*Prover) MarshalErrorResponse

func (s *Prover) MarshalErrorResponse(command []byte, e error) (*token.SignedCommandResponse, error)

func (*Prover) ProcessCommand

func (s *Prover) ProcessCommand(ctx context.Context, sc *token.SignedCommand) (*token.SignedCommandResponse, error)

func (*Prover) RequestImport

func (s *Prover) RequestImport(ctx context.Context, header *token.Header, requestImport *token.ImportRequest) (*token.CommandResponse_TokenTransaction, error)

func (*Prover) ValidateHeader

func (s *Prover) ValidateHeader(header *token.Header) error

type ResponseMarshaler

type ResponseMarshaler struct {
	Signer  Signer
	Creator []byte
	Time    TimeFunc
}

ResponseMarshaler produces token.SignedCommandResponse

func NewResponseMarshaler

func NewResponseMarshaler(signerID SignerIdentity) (*ResponseMarshaler, error)

func (*ResponseMarshaler) MarshalCommandResponse

func (s *ResponseMarshaler) MarshalCommandResponse(command []byte, responsePayload interface{}) (*token.SignedCommandResponse, error)

type SignedDataPolicyChecker

type SignedDataPolicyChecker interface {
	// CheckPolicyBySignedData checks that the provided signed data is valid with respect to
	// specified policy for the specified channel.
	CheckPolicyBySignedData(channelID, policyName string, sd []*common.SignedData) error
}

type Signer

type Signer interface {
	// Sign signs the given payload and returns a signature
	Sign([]byte) ([]byte, error)
}

type SignerIdentity

type SignerIdentity interface {
	Signer

	// Serialize returns a byte representation of this identity which is used to verify
	// messages signed by this SignerIdentity
	Serialize() ([]byte, error)
}

SignerIdentity signs messages and serializes its public identity to bytes

type TMSManager

type TMSManager interface {
	// GetIssuer returns an Issuer bound to the passed channel and whose credential
	// is the tuple (privateCredential, publicCredential).
	GetIssuer(channel string, privateCredential, publicCredential []byte) (Issuer, error)
}

type TimeFunc

type TimeFunc func() time.Time

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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