Documentation ¶
Overview ¶
Package iden3comm defines core structures and intefaces for the messaging protocol
Index ¶
- Constants
- type BasicMessage
- type MediaType
- type PackageManager
- func (r *PackageManager) GetMediaType(envelope []byte) (MediaType, error)
- func (r *PackageManager) Pack(mediaType MediaType, payload []byte, params PackerParams) ([]byte, error)
- func (r *PackageManager) RegisterPackers(packers ...Packer) error
- func (r *PackageManager) TrimDoubleQuoutes(msg []byte) []byte
- func (r *PackageManager) Unpack(envelope []byte) (*BasicMessage, MediaType, error)
- func (r *PackageManager) UnpackWithType(mediaType MediaType, envelope []byte) (*BasicMessage, error)
- type Packer
- type PackerParams
- type ProtocolMessage
Constants ¶
const DidCommProtocol = "https://didcomm.org/"
DidCommProtocol is a const for didcomm protocol definition
const Iden3Protocol = "https://iden3-communication.io/"
Iden3Protocol is a const for protocol definition
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicMessage ¶
type BasicMessage struct { ID string `json:"id"` Typ MediaType `json:"typ,omitempty"` Type ProtocolMessage `json:"type"` ThreadID string `json:"thid,omitempty"` Body json.RawMessage `json:"body,omitempty"` From string `json:"from,omitempty"` To string `json:"to,omitempty"` CreatedTime *int64 `json:"created_time,omitempty"` ExpiresTime *int64 `json:"expires_time,omitempty"` }
BasicMessage is structure for message with unknown body format
type PackageManager ¶
type PackageManager struct {
// contains filtered or unexported fields
}
PackageManager is a registry of packers for iden3comm protocol
func NewPackageManager ¶
func NewPackageManager() *PackageManager
NewPackageManager return new packager
func (*PackageManager) GetMediaType ¶
func (r *PackageManager) GetMediaType(envelope []byte) (MediaType, error)
GetMediaType returns MediaType of envelope
func (*PackageManager) Pack ¶
func (r *PackageManager) Pack(mediaType MediaType, payload []byte, params PackerParams) ([]byte, error)
Pack performs packing of message with a given mediatype
func (*PackageManager) RegisterPackers ¶
func (r *PackageManager) RegisterPackers(packers ...Packer) error
RegisterPackers adds new packers to packageManager
func (*PackageManager) TrimDoubleQuoutes ¶
func (r *PackageManager) TrimDoubleQuoutes(msg []byte) []byte
TrimDoubleQuoutes removes double quotes from message
func (*PackageManager) Unpack ¶
func (r *PackageManager) Unpack(envelope []byte) (*BasicMessage, MediaType, error)
Unpack returns iden3 message method from envelope if it's not valid or can't be decrypted error is returned
func (*PackageManager) UnpackWithType ¶
func (r *PackageManager) UnpackWithType(mediaType MediaType, envelope []byte) (*BasicMessage, error)
UnpackWithType unpack envelop with target media type.
type Packer ¶
type Packer interface { // Pack a payload of type ContentType in an Iden3 compliant format using the packer identity Pack(payload []byte, params PackerParams) ([]byte, error) // Unpack an envelope in Iden3 compliant format. Unpack(envelope []byte) (*BasicMessage, error) // MediaType returns content type of message MediaType() MediaType }
Packer converts message to encrypted or encoded form
type PackerParams ¶
type PackerParams interface {
Params()
}
PackerParams mock interface for packer params
Directories ¶
Path | Synopsis |
---|---|
Package mock defines mocks for protocol testing
|
Package mock defines mocks for protocol testing |
Package packers defines core 3 protocol packers: anoncrypt, plain and zkp
|
Package packers defines core 3 protocol packers: anoncrypt, plain and zkp |
Package protocol defines core protocol messages
|
Package protocol defines core protocol messages |
transport
|
|