didexchange

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 22 Imported by: 16

Documentation

Index

Constants

View Source
const (
	// DIDExchange did exchange protocol
	DIDExchange = "didexchange"
	// DIDExchangeSpec defines the did-exchange spec
	DIDExchangeSpec = "https://didcomm.org/didexchange/1.0/"
	// InvitationMsgType defines the did-exchange invite message type.
	InvitationMsgType = DIDExchangeSpec + "invitation"
	// RequestMsgType defines the did-exchange request message type.
	RequestMsgType = DIDExchangeSpec + "request"
	// ResponseMsgType defines the did-exchange response message type.
	ResponseMsgType = DIDExchangeSpec + "response"
	// AckMsgType defines the did-exchange ack message type.
	AckMsgType = DIDExchangeSpec + "ack"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DID    string   `json:"did,omitempty"`
	DIDDoc *did.Doc `json:"did_doc,omitempty"`
}

Connection connection

type ConnectionRecord

type ConnectionRecord struct {
	ConnectionID    string
	State           string
	ThreadID        string
	TheirLabel      string
	TheirDID        string
	MyDID           string
	ServiceEndPoint string
	RecipientKeys   []string
	InvitationID    string
	Namespace       string
}

ConnectionRecord contain info about did exchange connection

type ConnectionRecorder

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

ConnectionRecorder takes care of connection related persistence features

func NewConnectionRecorder

func NewConnectionRecorder(transientStore, store storage.Store) *ConnectionRecorder

NewConnectionRecorder returns new connection record instance

func (*ConnectionRecorder) GetConnectionRecord

func (c *ConnectionRecorder) GetConnectionRecord(connectionID string) (*ConnectionRecord, error)

GetConnectionRecord return connection record based on the connection ID

func (*ConnectionRecorder) GetConnectionRecordAtState

func (c *ConnectionRecorder) GetConnectionRecordAtState(connectionID, stateID string) (*ConnectionRecord, error)

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

func (*ConnectionRecorder) GetConnectionRecordByNSThreadID

func (c *ConnectionRecorder) GetConnectionRecordByNSThreadID(nsThreadID string) (*ConnectionRecord, error)

GetConnectionRecordByNSThreadID return connection record via namespaced threadID

func (*ConnectionRecorder) GetInvitation

func (c *ConnectionRecorder) GetInvitation(id string) (*Invitation, error)

GetInvitation returns invitation for given key from underlying store and stores the result in the value pointed to by v

Args:

id: invitation id

Returns:

invitation found error: error

func (*ConnectionRecorder) QueryConnectionRecords

func (c *ConnectionRecorder) QueryConnectionRecords() ([]*ConnectionRecord, error)

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

func (*ConnectionRecorder) SaveInvitation

func (c *ConnectionRecorder) SaveInvitation(invitation *Invitation) error

SaveInvitation saves connection invitation to underlying store

Args:

verKey: recipient key of the invitation object to be saved in store invitation: invitation to be stored

Returns:

error: error

type ConnectionSignature

type ConnectionSignature struct {
	Type       string `json:"@type,omitempty"`
	Signature  string `json:"signature,omitempty"`
	SignedData string `json:"sig_data,omitempty"`
	SignVerKey string `json:"signers,omitempty"`
}

ConnectionSignature connection signature

type Invitation

type Invitation struct {
	// the Image URL of the connection invitation
	ImageURL string `json:"imageUrl,omitempty"`

	// the Service endpoint of the connection invitation
	ServiceEndpoint string `json:"serviceEndpoint,omitempty"`

	// the RecipientKeys for the connection invitation
	RecipientKeys []string `json:"recipientKeys,omitempty"`

	// the ID of the connection invitation
	ID string `json:"@id,omitempty"`

	// the Label of the connection invitation
	Label string `json:"label,omitempty"`

	// the DID of the connection invitation
	DID string `json:"did,omitempty"`

	// the RoutingKeys of the connection invitation
	RoutingKeys []string `json:"routingKeys,omitempty"`

	// the Type of the connection invitation
	Type string `json:"@type,omitempty"`
}

Invitation model

Invitation defines DID exchange invitation message https://github.com/hyperledger/aries-rfcs/tree/master/features/0023-did-exchange#0-invitation-to-exchange

type Request

type Request struct {
	Type       string            `json:"@type,omitempty"`
	ID         string            `json:"@id,omitempty"`
	Label      string            `json:"label,omitempty"`
	Connection *Connection       `json:"connection,omitempty"`
	Thread     *decorator.Thread `json:"~thread,omitempty"`
}

Request defines a2a DID exchange request https://github.com/hyperledger/aries-rfcs/tree/master/features/0023-did-exchange#1-exchange-request

type Response

type Response struct {
	Type                string               `json:"@type,omitempty"`
	ID                  string               `json:"@id,omitempty"`
	ConnectionSignature *ConnectionSignature `json:"connection~sig,omitempty"`
	Thread              *decorator.Thread    `json:"~thread,omitempty"`
}

Response defines a2a DID exchange response https://github.com/hyperledger/aries-rfcs/tree/master/features/0023-did-exchange#2-exchange-response

type Service

type Service struct {
	service.Action
	service.Message
	// contains filtered or unexported fields
}

Service for DID exchange protocol

func New

func New(didMaker didcreator.Creator, prov provider) (*Service, error)

New return didexchange service

func (*Service) Accept

func (s *Service) Accept(msgType string) bool

Accept msg checks the msg type

func (*Service) AcceptExchangeRequest

func (s *Service) AcceptExchangeRequest(connectionID string) error

AcceptExchangeRequest accepts/approves connection request.

func (*Service) AcceptInvitation

func (s *Service) AcceptInvitation(connectionID string) error

AcceptInvitation accepts/approves connection invitation.

func (*Service) HandleInbound

func (s *Service) HandleInbound(msg *service.DIDCommMsg) (string, error)

HandleInbound handles inbound didexchange messages.

func (*Service) HandleOutbound

func (s *Service) HandleOutbound(msg *service.DIDCommMsg, destination *service.Destination) error

HandleOutbound handles outbound didexchange messages.

func (*Service) Name

func (s *Service) Name() string

Name return service name

Jump to

Keyboard shortcuts

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