connection

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 29

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 DIDRotationRecord added in v0.1.8

type DIDRotationRecord struct {
	OldDID    string `json:"oldDID,omitempty"`
	NewDID    string `json:"newDID,omitempty"`
	FromPrior string `json:"fromPrior,omitempty"`
}

DIDRotationRecord holds information about a DID Rotation.

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 added in v0.1.2

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) GetConnectionRecordByDIDs added in v0.1.8

func (c *Lookup) GetConnectionRecordByDIDs(myDID, theirDID string) (*Record, error)

GetConnectionRecordByDIDs return connection record for completed connection based on the DIDs of the participants.

func (*Lookup) GetConnectionRecordByNSThreadID

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

GetConnectionRecordByNSThreadID return connection record via namespaced threadID.

func (*Lookup) GetConnectionRecordByTheirDID added in v0.1.8

func (c *Lookup) GetConnectionRecordByTheirDID(theirDID string) (*Record, error)

GetConnectionRecordByTheirDID return connection record for completed connection based on the DID of the other party.

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) GetOOBv2Invitation added in v0.1.8

func (c *Lookup) GetOOBv2Invitation(myDID string, target interface{}) error

GetOOBv2Invitation finds and parses stored OOBv2 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         model.Endpoint // ServiceEndPoint is 'their' DIDComm service endpoint.
	RecipientKeys           []string       // RecipientKeys holds 'their' DIDComm recipient keys.
	RoutingKeys             []string       // RoutingKeys holds 'their' DIDComm routing keys.
	InvitationID            string
	InvitationDID           string
	InvitationRecipientKeys []string `json:"invitationRecipientKeys,omitempty"` // InvitationRecipientKeys holds keys generated for invitation
	Implicit                bool
	Namespace               string
	MediaTypeProfiles       []string
	DIDCommVersion          didcomm.Version
	PeerDIDInitialState     string
	MyDIDRotation           *DIDRotationRecord `json:"myDIDRotation,omitempty"`
}

Record contain info about did exchange connection. nolint:lll

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 added in v0.1.3

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.

func (*Recorder) SaveOOBv2Invitation added in v0.1.8

func (c *Recorder) SaveOOBv2Invitation(myDID string, invitation interface{}) error

SaveOOBv2Invitation saves OOBv2 invitation in permanent store under given ID. TODO should avoid using target of type `interface{}` [Issue #1030].

Jump to

Keyboard shortcuts

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