Documentation
¶
Overview ¶
Package iden3comm defines core structures and intefaces for the messaging protocol
Index ¶
- Constants
- type AttachData
- type Attachment
- type BasicMessage
- type MediaType
- type PackageManager
- func (r *PackageManager) GetMediaType(envelope []byte) (MediaType, error)
- func (r *PackageManager) GetSupportedProfiles() []string
- func (r *PackageManager) IsProfileSupported(profile string) bool
- 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 AttachData ¶ added in v2.11.4
type AttachData struct {
JSON interface{} `json:"json,omitempty"`
}
AttachData represents the data field in a DIDComm attachment
type Attachment ¶ added in v2.11.4
type Attachment struct {
ID string `json:"id"`
Description string `json:"description,omitempty"`
MediaType MediaType `json:"media_type,omitempty"`
Format string `json:"format,omitempty"`
Data AttachData `json:"data"`
}
Attachment represents a DIDComm message attachment
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"`
Attachments []Attachment `json:"attachments,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) GetSupportedProfiles ¶ added in v2.10.0
func (r *PackageManager) GetSupportedProfiles() []string
GetSupportedProfiles retrieves all unique supported profiles.
func (*PackageManager) IsProfileSupported ¶ added in v2.10.0
func (r *PackageManager) IsProfileSupported(profile string) bool
IsProfileSupported checks if profile is supported by packer manager
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
// GetSupportedProfiles returns supported accept profiles
GetSupportedProfiles() []string
// IsProfileSupported checks if profile is supported by packer
IsProfileSupported(profile string) bool
}
Packer converts message to encrypted or encoded form
type PackerParams ¶
type PackerParams interface {
Params()
}
PackerParams mock interface for packer params
Directories
¶
| Path | Synopsis |
|---|---|
|
handlers
|
|
|
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
|
|