didcomm

package
v0.31.65 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package didcomm is package to offer interfaces for all types of the didcomm messages. The package helps to abstract indy's legacy messages as well as new Aries messages. Corresponding packages are mesg and aries.

The package offers needed interfaces, some helper functions and variables. More information can be found from each individual type.

Index

Constants

This section is empty.

Variables

View Source
var CreatorGod = God{}

CreatorGod creates payloads and messages by namespace string.

Functions

func FieldAtInd

func FieldAtInd(s string, where int) string

Types

type CredentialAttribute

type CredentialAttribute struct {
	Name     string `json:"name,omitempty"`
	Value    string `json:"value,omitempty"`
	MimeType string `json:"mime-type,omitempty"`
}

CredentialAttribute for credential value

type Factor

type Factor interface {
	NewMessage(data []byte) MessageHdr
	NewMsg(init MsgInit) MessageHdr
}

type God

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

func (*God) AddMsgCreator

func (g *God) AddMsgCreator(namespace string, c MsgFactor)

func (*God) AddPayloadCreator

func (g *God) AddPayloadCreator(namespace string, c PayloadFactor)

func (*God) MsgCreator

func (g *God) MsgCreator(namespace string) MsgFactor

func (*God) MsgCreatorByType

func (g *God) MsgCreatorByType(t string) MsgFactor

func (*God) PayloadCreator

func (g *God) PayloadCreator(namespace string) PayloadFactor

func (*God) PayloadCreatorByType

func (g *God) PayloadCreatorByType(t string) PayloadFactor

type JSONSpeaker

type JSONSpeaker interface {
	JSON() []byte
}

type MessageHdr

type MessageHdr interface {
	PayloadHdr
	PayloadWriteHdr

	JSON() []byte
	Thread() *decorator.Thread
	FieldObj() interface{}
}

MessageHdr is the base interface for all protocol messages. It has the minimum needed to handle and process inbound and outbound protocol messages. The are message factors to help creation of these messages as well. This is the interface which should be used for all common references to didcomm messages. Please be noted that there still is a Payload concept which is a envelope level abstraction, and works well with the message.

type Msg

type Msg interface {
	MessageHdr

	SubLevelID() string

	Ready() bool
}

Msg is a legacy interface for before Aries message protocols. For new Aries protocols it isn't recommended to use it, but use MessageHdr instead.

type MsgFactor

type MsgFactor interface {
	Factor

	Create(mcd MsgInit) MessageHdr
}

type MsgInit

type MsgInit struct {
	AID        string
	Type       string
	Nonce      string
	Error      string
	Did        string
	VerKey     string
	Endpoint   string
	EndpVerKey string
	RcvrEndp   service.Addr
	Name       string
	Info       string
	ID         string
	Ready      bool
	Thread     *decorator.Thread
	DIDObj     core.DID
	To         string
	Msg        map[string]interface{}
}

MsgInit is a helper struct for factors to construct new message instances.

type Payload

type Payload interface {
	PayloadHdr
	PayloadThread
	JSONSpeaker

	SetType(t string)

	Creator() PayloadFactor
	MsgCreator() MsgFactor

	FieldObj() interface{}

	Message() Msg       // this is mostly for legacy message handling, before Aries
	MsgHdr() MessageHdr // this generic and preferable way to get the message

	Protocol() string
	ProtocolMsg() string
	Namespace() string
}

type PayloadFactor

type PayloadFactor interface {
	NewFromData(data []byte) Payload
	New(pi PayloadInit) Payload
	NewMsg(id, t string, m MessageHdr) Payload
}

type PayloadHdr

type PayloadHdr interface {
	ID() string
	Type() string
}

type PayloadInit

type PayloadInit struct {
	ID   string
	Type string
	MsgInit
}

type PayloadThread

type PayloadThread interface {
	Thread() *decorator.Thread
	SetThread(t *decorator.Thread)
	ThreadID() string
}

type PayloadWriteHdr

type PayloadWriteHdr interface {
	SetID(id string)
	SetType(t string)
}

type ProofAttribute

type ProofAttribute struct {
	ID        string `json:"-"`
	Name      string `json:"name,omitempty"`
	CredDefID string `json:"credDefId,omitempty"`
	Predicate string `json:"predicate,omitempty"`
	Value     string `json:"-"`
}

ProofAttribute for proof request attributes

type ProofPredicate added in v0.24.26

type ProofPredicate struct {
	ID     string `json:"-"`
	Name   string `json:"name,omitempty"`
	PType  string `json:"p_type,omitempty"`
	PValue int64  `json:"p_value,omitempty"`
}

ProofPredicate for proof request predicates

type ProofValue

type ProofValue struct {
	Name      string `json:"name,omitempty"`
	Value     string `json:"value,omitempty"`
	CredDefID string `json:"credDefId,omitempty"`
	Predicate string `json:"predicate,omitempty"`
}

ProofValue for proof values

Jump to

Keyboard shortcuts

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