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 ¶
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 ¶
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.