connection

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateNameCompleted completed state.
	StateNameCompleted = "completed"
	// MyNSPrefix namespace val my.
	MyNSPrefix = "my"
	// TheirNSPrefix namespace val their
	// TODO: https://github.com/hyperledger/aries-framework-go/issues/556 It will not be constant, this namespace
	//  will need to be figured with verification key
	TheirNSPrefix = "their"
)
View Source
const (
	// Namespace is namespace of connection store name.
	Namespace = "didexchange"
)

Variables

This section is empty.

Functions

func CreateNamespaceKey

func CreateNamespaceKey(prefix, thID string) (string, error)

CreateNamespaceKey creates key prefix for namespace related data.

Types

type KeyPrefix

type KeyPrefix func(...string) string

KeyPrefix is prefix builder for storage keys.

type Lookup

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

Lookup takes care of connection related persistence features.

func NewLookup

func NewLookup(p provider) (*Lookup, error)

NewLookup returns new connection lookup instance. Lookup is read only connection store. It provides connection record related query features.

func (*Lookup) GetConnectionIDByDIDs

func (c *Lookup) GetConnectionIDByDIDs(myDID, theirDID string) (string, error)

GetConnectionIDByDIDs return connection id based on dids (my or their did) metadata.

func (*Lookup) GetConnectionRecord

func (c *Lookup) GetConnectionRecord(connectionID string) (*Record, error)

GetConnectionRecord return connection record based on the connection ID.

func (*Lookup) GetConnectionRecordAtState

func (c *Lookup) GetConnectionRecordAtState(connectionID, stateID string) (*Record, error)

GetConnectionRecordAtState return connection record based on the connection ID and state.

func (*Lookup) GetConnectionRecordByNSThreadID

func (c *Lookup) GetConnectionRecordByNSThreadID(nsThreadID string) (*Record, error)

GetConnectionRecordByNSThreadID return connection record via namespaced threadID.

func (*Lookup) GetInvitation

func (c *Lookup) GetInvitation(id string, target interface{}) error

GetInvitation finds and parses stored invitation to target type. TODO should avoid using target of type `interface{}` [Issue #1030].

func (*Lookup) QueryConnectionRecords

func (c *Lookup) QueryConnectionRecords() ([]*Record, error)

QueryConnectionRecords returns connection records found in underlying store for given query criteria.

type Record

type Record struct {
	ConnectionID    string
	State           string
	ThreadID        string
	ParentThreadID  string
	TheirLabel      string
	TheirDID        string
	MyDID           string
	ServiceEndPoint string
	RecipientKeys   []string
	RoutingKeys     []string
	InvitationID    string
	InvitationDID   string
	Implicit        bool
	Namespace       string
}

Record contain info about did exchange connection.

type Recorder

type Recorder struct {
	*Lookup
}

Recorder is read-write connection store.

func NewRecorder

func NewRecorder(p provider) (*Recorder, error)

NewRecorder returns new connection recorder. Recorder is read-write connection store which provides write features on top query features from Lookup.

func (*Recorder) GetEvent

func (c *Recorder) GetEvent(connectionID string) ([]byte, error)

GetEvent returns persisted event data for given connection ID. TODO connection event data shouldn't be transient [Issues #1029].

func (*Recorder) RemoveConnection

func (c *Recorder) RemoveConnection(connectionID string) error

RemoveConnection removes connection record from the store for given id.

func (*Recorder) SaveConnectionRecord

func (c *Recorder) SaveConnectionRecord(record *Record) error

SaveConnectionRecord saves given connection records in underlying store.

func (*Recorder) SaveConnectionRecordWithMappings

func (c *Recorder) SaveConnectionRecordWithMappings(record *Record) error

SaveConnectionRecordWithMappings saves newly created connection record against the connection id in the store and it creates mapping from namespaced ThreadID to connection ID.

func (*Recorder) SaveEvent

func (c *Recorder) SaveEvent(connectionID string, data []byte) error

SaveEvent saves event related data for given connection ID TODO connection event data shouldn't be transient [Issues #1029].

func (*Recorder) SaveInvitation

func (c *Recorder) SaveInvitation(id string, invitation interface{}) error

SaveInvitation saves invitation in permanent store for given key. TODO should avoid using target of type `interface{}` [Issue #1030].

func (*Recorder) SaveNamespaceThreadID

func (c *Recorder) SaveNamespaceThreadID(threadID, namespace, connectionID string) error

SaveNamespaceThreadID saves given namespace, threadID and connection ID mapping in protocol state store.

Jump to

Keyboard shortcuts

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