didexchange

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 15

Documentation

Index

Constants

View Source
const (
	CommandName = "didexchange"

	AcceptExchangeRequestCommandMethod    = "AcceptExchangeRequest"
	AcceptInvitationCommandMethod         = "AcceptInvitation"
	CreateImplicitInvitationCommandMethod = "CreateImplicitInvitation"
	CreateInvitationCommandMethod         = "CreateInvitation"
	QueryConnectionByIDCommandMethod      = "QueryConnectionByID"
	QueryConnectionsCommandMethod         = "QueryConnections"
	ReceiveInvitationCommandMethod        = "ReceiveInvitation"
	CreateConnectionCommandMethod         = "CreateConnection"
	RemoveConnectionCommandMethod         = "RemoveConnection"
)

constants for endpoints of DIDExchange.

View Source
const (
	// InvalidRequestErrorCode is typically a code for validation errors
	// for invalid didexchange controller requests.
	InvalidRequestErrorCode = command.Code(iota + command.DIDExchange)

	// CreateInvitationErrorCode is for failures in create invitation command.
	CreateInvitationErrorCode

	// CreateImplicitInvitationErrorCode is for failures in create implicit invitation command.
	CreateImplicitInvitationErrorCode

	// ReceiveInvitationErrorCode is for failures in receive invitation command.
	ReceiveInvitationErrorCode

	// AcceptInvitationErrorCode is for failures in accept invitation command.
	AcceptInvitationErrorCode

	// AcceptExchangeRequestErrorCode is for failures in accept exchange request command.
	AcceptExchangeRequestErrorCode

	// QueryConnectionsErrorCode is for failures in query connection command.
	QueryConnectionsErrorCode

	// RemoveConnectionErrorCode is for failures in remove connection command.
	RemoveConnectionErrorCode

	// CreateConnectionErrorCode is for failures in create connection command.
	CreateConnectionErrorCode
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptExchangeRequestArgs

type AcceptExchangeRequestArgs struct {
	// Connection ID
	ID string `json:"id"`

	// Optional Public DID to be used for this invitation
	// request
	Public string `json:"public"`

	// Optional specifies router connections (comma-separated values)
	RouterConnections string `json:"router_connections"`
}

AcceptExchangeRequestArgs model

This is used for accepting connection request.

type AcceptInvitationArgs

type AcceptInvitationArgs struct {
	// Connection ID
	ID string `json:"id"`

	// Optional Public DID to be used for this request
	Public string `json:"public"`

	// Optional specifies router connections (comma-separated values)
	RouterConnections string `json:"router_connections"`
}

AcceptInvitationArgs model

This is used for operation to accept connection invitation.

type AcceptInvitationResponse

type AcceptInvitationResponse struct {

	// State of the connection invitation
	State string `json:"state,omitempty"`

	// Other party's DID
	InviterDID string `json:"their_did,omitempty"`

	// Created time
	CreateTime time.Time `json:"created_at,omitempty"`

	// Connection invitation accept mode
	Accept string `json:"accept,omitempty"`

	// My DID
	DID string `json:"my_did,omitempty"`

	// Invitation ID of invitation response
	RequestID string `json:"request_id,omitempty"`

	// Other party's label
	InviterLabel string `json:"their_label,omitempty"`

	// Alias
	Alias string `json:"alias,omitempty"`

	// Other party's role
	InviterRole string `json:"their_role,omitempty"`

	// Connection invitation initiator
	Initiator string `json:"initiator,omitempty"`

	// Updated time
	UpdateTime time.Time `json:"updated_at,omitempty"`

	// Invitation key
	InvitationKey string `json:"invitation_key,omitempty"`

	// Routing state of connection invitation
	RoutingState string `json:"routing_state,omitempty"`

	// Inbound Connection ID  of the connection invitation
	InboundConnectionID string `json:"inbound_connection_id,omitempty"`

	// the connection ID of the connection invitation
	ConnectionID string `json:"connection_id,omitempty"`

	// Error message
	Error string `json:"error_msg,omitempty"`

	// Invitation mode
	Mode string `json:"invitation_mode,omitempty"`
}

AcceptInvitationResponse model

This is used for returning a accept invitation response for single invitation.

type Command

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

Command is controller command for DID Exchange.

func New

func New(ctx provider, notifier command.Notifier, defaultLabel string, autoAccept bool) (*Command, error)

New returns new DID Exchange controller command instance.

func (*Command) AcceptExchangeRequest

func (c *Command) AcceptExchangeRequest(rw io.Writer, req io.Reader) command.Error

AcceptExchangeRequest accepts a stored connection request.

func (*Command) AcceptInvitation

func (c *Command) AcceptInvitation(rw io.Writer, req io.Reader) command.Error

AcceptInvitation accepts a stored connection invitation.

func (*Command) CreateConnection added in v0.1.4

func (c *Command) CreateConnection(rw io.Writer, req io.Reader) command.Error

CreateConnection creates a new connection record in completed state and returns the generated connectionID.

func (*Command) CreateImplicitInvitation

func (c *Command) CreateImplicitInvitation(rw io.Writer, req io.Reader) command.Error

CreateImplicitInvitation creates implicit invitation using inviter DID.

func (*Command) CreateInvitation

func (c *Command) CreateInvitation(rw io.Writer, req io.Reader) command.Error

CreateInvitation Creates a new connection invitation.

func (*Command) GetHandlers

func (c *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) QueryConnectionByID

func (c *Command) QueryConnectionByID(rw io.Writer, req io.Reader) command.Error

QueryConnectionByID fetches a single connection record by connection ID.

func (*Command) QueryConnections

func (c *Command) QueryConnections(rw io.Writer, req io.Reader) command.Error

QueryConnections queries agent to agent connections.

func (*Command) ReceiveInvitation

func (c *Command) ReceiveInvitation(rw io.Writer, req io.Reader) command.Error

ReceiveInvitation receives a new connection invitation.

func (*Command) RemoveConnection

func (c *Command) RemoveConnection(rw io.Writer, req io.Reader) command.Error

RemoveConnection removes given connection record.

type ConnectionIDArg

type ConnectionIDArg struct {
	// Connection ID
	ID string `json:"id"`
}

ConnectionIDArg model

This is used for querying/removing connection by ID.

type CreateConnectionRequest added in v0.1.4

type CreateConnectionRequest struct {
	MyDID          string      `json:"myDID"`
	TheirDID       DIDDocument `json:"theirDID"`
	TheirLabel     string      `json:"theirLabel,omitempty"`
	InvitationID   string      `json:"invitationID,omitempty"`
	InvitationDID  string      `json:"invitationDID,omitempty"`
	ParentThreadID string      `json:"parentThreadID,omitempty"`
	ThreadID       string      `json:"threadID,omitempty"`
	Implicit       bool        `json:"implicit,omitempty"`
}

CreateConnectionRequest model

This is used for creating connection request.

type CreateInvitationArgs

type CreateInvitationArgs struct {

	// The Alias to be used in invitation to be created
	Alias string `json:"alias"`

	// Optional public DID to be used in invitation
	Public string `json:"public,omitempty"`

	// Optional specifies router connection id
	RouterConnectionID string `json:"router_connection_id"`
}

CreateInvitationArgs model

This is used for creating invitation.

type CreateInvitationResponse

type CreateInvitationResponse struct {
	Invitation *didexchange.Invitation `json:"invitation"`

	Alias string `json:"alias"`

	InvitationURL string `json:"invitation_url"`
}

CreateInvitationResponse model

This is used for returning a create invitation response with a single connection invitation as body.

type DIDDocument added in v0.1.4

type DIDDocument struct {
	ID       string          `json:"id"`
	Contents json.RawMessage `json:"contents"`
}

DIDDocument model.

type ExchangeResponse

type ExchangeResponse struct {

	// Routing state of connection invitation
	RoutingState string `json:"routing_state,omitempty"`

	// the connection ID of the connection invitation
	InboundConnectionID string `json:"inbound_connection_id,omitempty"`

	// Invitation key
	InvitationKey string `json:"invitation_key,omitempty"`

	// TheirDID is other party's DID
	TheirDID string `json:"their_did"`

	// Invitation ID of the connection request
	RequestID string `json:"request_id"`

	// Invitation mode
	Mode string `json:"invitation_mode,omitempty"`

	// TheirRole is other party's role
	TheirRole string `json:"their_role,omitempty"`

	// TheirRole is other party's role
	TheirLabel string `json:"their_label,omitempty"`

	// the connection ID of the connection invitation
	ConnectionID string `json:"connection_id,omitempty"`

	// Initiator is Connection invitation initiator
	Initiator string `json:"initiator,omitempty"`

	// MyDID is DID of the agent
	MyDID string `json:"my_did,omitempty"`

	// Updated time
	UpdatedTime time.Time `json:"updated_at,omitempty"`

	// Created time
	CreatedTime time.Time `json:"created_at,omitempty"`

	// Error message
	Error string `json:"error_msg,omitempty"`

	// Alias of connection invitation
	Alias string `json:"alias,omitempty"`

	// State of the connection invitation
	State string `json:"state"`

	// Connection invitation accept mode
	Accept string `json:"accept,omitempty"`
}

ExchangeResponse model

response of accept exchange request.

type GetConnectionRequest

type GetConnectionRequest struct {
	// The ID of the connection to get
	ID string `json:"id"`
}

GetConnectionRequest model

This is used for getting specific connection record.

type ImplicitInvitationArgs

type ImplicitInvitationArgs struct {
	// InviterDID
	InviterDID string `json:"their_did"`

	// Optional inviter label
	InviterLabel string `json:"their_label"`

	// Optional invitee did
	InviteeDID string `json:"my_did"`

	// Optional invitee label
	InviteeLabel string `json:"my_label"`

	// Optional specifies router connections (comma-separated values)
	RouterConnections string `json:"router_connections"`
}

ImplicitInvitationArgs model

This is used by invitee to create implicit invitation.

type ImplicitInvitationResponse

type ImplicitInvitationResponse struct {
	// the connection ID of the connection for implicit invitation
	ConnectionID string `json:"connection_id,omitempty"`
}

ImplicitInvitationResponse model

This is used for returning create implicit invitation response.

type QueryConnectionResponse

type QueryConnectionResponse struct {
	Result *didexchange.Connection `json:"result,omitempty"`
}

QueryConnectionResponse model

This is used for returning query connection result for single record search.

type QueryConnectionsArgs

type QueryConnectionsArgs struct {
	// Params for querying connections
	didexchange.QueryConnectionsParams
}

QueryConnectionsArgs model

This is used for querying connections.

type QueryConnectionsResponse

type QueryConnectionsResponse struct {
	Results []*didexchange.Connection `json:"results,omitempty"`
}

QueryConnectionsResponse model

This is used for returning query connections results.

type ReceiveInvitationResponse

type ReceiveInvitationResponse struct {
	// State of the connection invitation
	State string `json:"state"`

	// Created time
	CreateTime time.Time `json:"created_at,omitempty"`

	// Updated time
	UpdateTime time.Time `json:"updated_at,omitempty"`

	// the connection ID of the connection invitation
	ConnectionID string `json:"connection_id"`

	// Routing state of connection invitation
	RoutingState string `json:"routing_state,omitempty"`

	// Connection invitation initiator
	Initiator string `json:"initiator,omitempty"`

	// Connection invitation accept mode
	Accept string `json:"accept,omitempty"`

	// Invitation mode
	Mode string `json:"invitation_mode,omitempty"`

	// Invitation ID of invitation response
	RequestID string `json:"request_id"`

	// My DID
	DID string `json:"my_did"`

	// Invitation key
	InvitationKey string `json:"invitation_key,omitempty"`

	// Other party's label
	InviterLabel string `json:"their_label,omitempty"`
}

ReceiveInvitationResponse model

This is used for returning a receive invitation response with a single receive invitation response as body.

type RemoveConnectionRequest

type RemoveConnectionRequest struct {
	// The ID of the connection record to remove
	ID string `json:"id"`
}

RemoveConnectionRequest model

This is used for removing connection request.

Jump to

Keyboard shortcuts

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