basic

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package basic provide basic message protocol features

Any incoming message of type "https://didcomm.org/basicmessage/1.0/message" can be handled by registering `basic.MessageService`.

RFC Reference:

https://github.com/hyperledger/aries-rfcs/tree/master/features/0095-basic-message

Index

Constants

View Source
const (
	// MessageRequestType is basic message DIDComm message type.
	MessageRequestType = "https://didcomm.org/basicmessage/1.0/message"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID   string `json:"@id"`
	Type string `json:"@type"`
	I10n struct {
		Locale string `json:"locale"`
	} `json:"~l10n"`
	SentTime time.Time `json:"sent_time"`
	Content  string    `json:"content"`
}

Message is message model for basic message protocol Reference:

https://github.com/hyperledger/aries-rfcs/tree/master/features/0095-basic-message#reference

type MessageHandle

type MessageHandle func(message Message, myDID, theirDID string) error

MessageHandle is handle function for basic message service which gets called by `basic.MessageService` to handle incoming messages.

Args

message : incoming basic message. myDID: receiving agent's DID. theirDID: sender agent's DID.

Returns

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

type MessageService

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

MessageService is message service which transports incoming basic messages to handlers provided.

func NewMessageService

func NewMessageService(name string, handle MessageHandle) (*MessageService, error)

NewMessageService creates basic message service which serves incoming basic messages [RFC-0095]

Args:

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

handle - is handle function to which incoming basic message will be sent(this is mandatory argument).

Returns:

MessageService: basic message service,

error: arg validation errors.

func (*MessageService) Accept

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

Accept is acceptance criteria for this basic message service,

func (*MessageService) HandleInbound

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

HandleInbound for basic message service.

func (*MessageService) Name

func (m *MessageService) Name() string

Name of basic message service.

Jump to

Keyboard shortcuts

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