http

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: 7 Imported by: 0

Documentation

Overview

Package http provides http-over-didcomm message service features.

Any incoming message of type "https://didcomm.org/http-over-didcomm/1.0/request" and matching purpose can be handled by registering 'OverDIDComm' message service.

RFC Reference:

https://github.com/hyperledger/aries-rfcs/blob/master/features/0335-http-over-didcomm/README.md https://github.com/hyperledger/aries-rfcs/blob/master/features/0351-purpose-decorator/README.md

Index

Constants

View Source
const (
	// OverDIDCommSpec is http over DIDComm Spec value.
	OverDIDCommSpec = "https://didcomm.org/http-over-didcomm/1.0/"

	// OverDIDCommMsgRequestType is http over DIDComm request message type.
	OverDIDCommMsgRequestType = OverDIDCommSpec + "request"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OverDIDComm

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

OverDIDComm is message service which transports incoming DIDComm message over to intended http resource providers.

func NewOverDIDComm

func NewOverDIDComm(name string, httpHandle RequestHandle, purpose ...string) (*OverDIDComm, error)

NewOverDIDComm creates new HTTP over DIDComm message service which serves incoming DIDComm message over HTTP. DIDComm message receiver of [RFC-0351]

Reference:

https://github.com/hyperledger/aries-rfcs/blob/master/features/0335-http-over-didcomm/README.md https://github.com/hyperledger/aries-rfcs/blob/master/features/0351-purpose-decorator/README.md

Args:

name - is name of this message service (this is mandatory argument).

purpose - is optional list of purposes to be handled by this message service. If not provided then only message type will be taken into consideration in acceptance criteria of this message service.

httpHandle - is handle function to which incoming DIDComm message will be sent after being converted to http request. (this is mandatory argument).

Returns:

OverDIDComm: http over didcomm message service,

error: arg validation errors.

func (*OverDIDComm) Accept

func (m *OverDIDComm) Accept(msgType string, purpose []string) bool

Accept is acceptance criteria for this HTTP over DIDComm message service, it accepts http-didcomm-over message type [RFC-0335] and follows `A tagging system` purpose field validation from RFC-0351.

func (*OverDIDComm) HandleInbound

func (m *OverDIDComm) HandleInbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)

HandleInbound for HTTP over DIDComm message service.

func (*OverDIDComm) Name

func (m *OverDIDComm) Name() string

Name of HTTP over DIDComm message service.

type RequestHandle

type RequestHandle func(msgID string, request *http.Request) error

RequestHandle handle function for http over did comm message service which gets called by `OverDIDComm` message service to handle matching incoming request.

Args

msgID : message ID of incoming message. request: http request derived from incoming DID comm message.

Returns

error : handle can return error back to service to notify message dispatcher about failures.

Jump to

Keyboard shortcuts

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