legacyconnection

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 31 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// LegacyConnection connection protocol.
	LegacyConnection = "legacyconnection"
	// PIURI is the connection protocol identifier URI.
	PIURI = "https://didcomm.org/connections/1.0"
	// InvitationMsgType defines the legacy-connection invite message type.
	InvitationMsgType = PIURI + "/invitation"
	// RequestMsgType defines the legacy-connection request message type.
	RequestMsgType = PIURI + "/request"
	// ResponseMsgType defines the legacy-connection response message type.
	ResponseMsgType = PIURI + "/response"
	// AckMsgType defines the legacy-connection ack message type.
	AckMsgType = "https://didcomm.org/notification/1.0/ack"
)
View Source
const (

	// StateIDInvited marks the invited phase of the connection protocol.
	StateIDInvited = "invited"
	// StateIDRequested marks the requested phase of the connection protocol.
	StateIDRequested = "requested"
	// StateIDResponded marks the responded phase of the connection protocol.
	StateIDResponded = "responded"
	// StateIDCompleted marks the completed phase of the connection protocol.
	StateIDCompleted = "completed"

	// PlsAckOnReceipt ack type that says, "Please send me an ack as soon as you receive this message.".
	PlsAckOnReceipt = "RECEIPT"
)
View Source
const (

	// InvitationRecipientKey is map key constant.
	InvitationRecipientKey = "invRecipientKey"
)

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:"DIDDoc,omitempty"`
}

Connection defines connection body of connection request.

type ConnectionSignature

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

ConnectionSignature connection signature.

type Invitation

type Invitation struct {
	// the Type of the connection invitation
	Type string `json:"@type,omitempty"`

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

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

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

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

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

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

Invitation model

Invitation defines Connection protocol invitation message https://github.com/hyperledger/aries-rfcs/tree/main/features/0160-connection-protocol#0-invitation-to-connect

type PleaseAck

type PleaseAck struct {
	On []string `json:"on,omitempty"`
}

PleaseAck connection response accepted acknowledgement.

type Request

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

Request defines a2a Connection request https://github.com/hyperledger/aries-rfcs/tree/main/features/0160-connection-protocol#1-connection-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"`
	PleaseAck           *PleaseAck           `json:"~please_ack,omitempty"`
}

Response defines a2a Connection response https://github.com/hyperledger/aries-rfcs/tree/main/features/0160-connection-protocol#2-connection-response

type Service

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

Service for Connection protocol.

func New

func New(prov provider) (*Service, error)

New return connection service.

func (*Service) Accept

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

Accept msg checks the msg type.

func (*Service) AcceptConnectionRequest

func (s *Service) AcceptConnectionRequest(connectionID, publicDID, label string, routerConnections []string) error

AcceptConnectionRequest accepts/approves connection request.

func (*Service) AcceptInvitation

func (s *Service) AcceptInvitation(connectionID, publicDID, label string, routerConnections []string) error

AcceptInvitation accepts/approves connection invitation.

func (*Service) CreateConnection

func (s *Service) CreateConnection(record *connection.Record, theirDID *did.Doc) error

CreateConnection saves the record to the connection store and maps TheirDID to their recipient keys in the did connection store.

func (*Service) CreateImplicitInvitation

func (s *Service) CreateImplicitInvitation(inviterLabel, inviterDID,
	inviteeLabel, inviteeDID string, routerConnections []string) (string, error)

CreateImplicitInvitation creates implicit invitation. Inviter DID is required, invitee DID is optional. If invitee DID is not provided new peer DID will be created for implicit invitation connection request.

func (*Service) HandleInbound

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

HandleInbound handles inbound connection messages.

func (*Service) HandleOutbound

func (s *Service) HandleOutbound(_ service.DIDCommMsg, _, _ string) (string, error)

HandleOutbound handles outbound connection messages.

func (*Service) Initialize

func (s *Service) Initialize(p interface{}) error

Initialize initializes the Service. If Initialize succeeds, any further call is a no-op.

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