comm

package
v0.25.34 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActiveRcvrs = Receivers{
	Rcvrs: make(map[string]Receiver),
}
View Source
var FileDownload = downloadFile

FileDownload is proxy function to route actual call to http or pseudo http in tests.

View Source
var Proc = &processor{}
View Source
var SendAndWaitReq = sendAndWaitHTTPRequest

SendAndWaitReq is proxy function to route actual call to http or pseudo http in tests.

Functions

func SendPL

func SendPL(sendPipe sec.Pipe, task Task, opl didcomm.Payload) (err error)

SendPL is helper function to send a protocol messages to receiver which is defined in the Task.ReceiverEndp. Function will encrypt messages before sending. It doesn't resend PL in case of failure. The recovering in done at PSM level.

Types

type Continuator

type Continuator func(ca Receiver, im didcomm.Msg)

type Creator added in v0.24.29

type Creator func(header *TaskHeader, protocol *pb.Protocol) (Task, error)

type FillStatus added in v0.25.13

type FillStatus func(workerDID string, taskID string, ps *pb.ProtocolStatus) *pb.ProtocolStatus

type Handler

type Handler interface {
}

Handler can be Agency or Agent. They can input Payloads.

type HandlerFunc

type HandlerFunc func(packet Packet) (err error)

HandlerFunc is func type for protocol message handlers. We add them to protocol processors with the associated message type. See Payload.Type

type Packet

type Packet struct {
	Payload  didcomm.Payload
	Address  *endp.Addr
	Receiver Receiver
}

type ProtHandler

type ProtHandler interface {
	Process(packet Packet) (err error)
}

ProtHandler is an interface for whole protocol. Where HandlerFunc is handler for protocol message, the protocol handler is whole protocol group, all of the same message family.

type ProtProc

type ProtProc struct {
	Creator
	Starter
	Handlers map[string]HandlerFunc
	Continuator
	FillStatus
}

ProtProc is a protocol processor. It is struct for protocol handlers. Instances of it are the actual protocol handlers. Just declare var and the needed msg handlers (HandlerFunc) and register it to the processor.

func (ProtProc) Process

func (p ProtProc) Process(packet Packet) (err error)

Process delivers the protocol message inside the packet to correct protocol function.

type Receiver

type Receiver interface {
	MyDID() *ssi.DID
	MyCA() Receiver
	WorkerEA() Receiver
	ExportWallet(key string, exportPath string) (url string)
	RootDid() *ssi.DID
	SendNYM(targetDid *ssi.DID, submitterDid, alias, role string) (err error)
	LoadDID(did string) *ssi.DID
	LoadTheirDID(pw ssi.Pairwise) *ssi.DID
	WDID() string
	PwPipe(pw string) (cp sec.Pipe, err error)
	Wallet() int
	Pool() int
	FindPWByDID(my string) (pw *ssi.Pairwise, err error)
	AttachSAImpl(implID string)
	AddToPWMap(me, you *ssi.DID, name string) sec.Pipe
	SaveTheirDID(did, vk string) (err error)
	CAEndp() (endP *endp.Addr)
	AddPipeToPWMap(p sec.Pipe, name string)
	MasterSecret() (string, error)
	AutoPermission() bool
	ID() string
}

type Receivers

type Receivers struct {
	Rcvrs map[string]Receiver
	Lk    sync.Mutex
}

func (*Receivers) Add

func (rs *Receivers) Add(DID string, r Receiver)

func (*Receivers) Get

func (rs *Receivers) Get(DID string) Receiver

type SeedHandler

type SeedHandler interface {
	Prepare() (Handler, error)
}

SeedHandler is preloaded cloud agent which is not initialized yet.

type Starter

type Starter func(ca Receiver, t Task)

type Task

type Task interface {
	ID() string                     // Unique uid: API Protocol ID/Protocol thread ID
	Type() string                   // Our internal payload type
	ProtocolType() pb.Protocol_Type // Aries protocol
	UserActionType() string         // Internal payload type when waiting for user action
	Role() pb.Protocol_Role         // Agent role in Aries protocol
	ConnectionID() string           // Pairwise id
	ReceiverEndp() service.Addr     // Pairwise receiver endpoint
	SetReceiverEndp(r service.Addr)
}

type TaskBase added in v0.24.29

type TaskBase struct {
	Task
	TaskHeader
}

func (*TaskBase) ConnectionID added in v0.24.29

func (t *TaskBase) ConnectionID() string

func (*TaskBase) ID added in v0.24.29

func (t *TaskBase) ID() string

func (*TaskBase) ProtocolType added in v0.25.4

func (t *TaskBase) ProtocolType() pb.Protocol_Type

func (*TaskBase) ReceiverEndp added in v0.24.29

func (t *TaskBase) ReceiverEndp() service.Addr

func (*TaskBase) Role added in v0.24.29

func (t *TaskBase) Role() pb.Protocol_Role

func (*TaskBase) SetReceiverEndp added in v0.24.29

func (t *TaskBase) SetReceiverEndp(r service.Addr)

func (*TaskBase) Type added in v0.24.29

func (t *TaskBase) Type() string

func (*TaskBase) UserActionType added in v0.25.4

func (t *TaskBase) UserActionType() string

type TaskHeader added in v0.24.29

type TaskHeader struct {
	TaskID           string
	TypeID           string
	ProtocolRole     pb.Protocol_Role
	ConnID           string
	UserActionPLType string

	Sender   service.Addr
	Receiver service.Addr
}

func (*TaskHeader) SwitchDirection added in v0.24.29

func (t *TaskHeader) SwitchDirection()

SwitchDirection changes SenderEndp and ReceiverEndp data

Jump to

Keyboard shortcuts

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