Documentation
¶
Index ¶
- Constants
- func ParseDIDEncryptionKeys(vms []did.Verification) ([]ecdsa.PublicKey, error)
- func ParseDIDEndpoints(endpoints []did.Service) ([]didCommEndpoint, error)
- func ParseMsgFromBytes(msg []byte, amount int64) (interface{}, error)
- func ParseMsgFromReq(msg io.ReadCloser) (interface{}, error)
- func PriortizeEndpoints(endpoints []didCommEndpoint, amt int64, settings *MessageSettings) []didCommEndpoint
- type Attachment
- type AttachmentData
- type BasicMsgBody
- type CallbackAssociateDIDMessage
- type CallbackMessage
- type DIDComm
- type DIDCommConfig
- type DIDCommMsg
- func NewBasicMsg(content string) *DIDCommMsg
- func NewDIDCommMsg() *DIDCommMsg
- func NewEncryptedMsg(encryptedMsg *EncryptedMsg, from, to string) *DIDCommMsg
- func NewForwardMsg(msgToForward interface{}, from, to, typ string) *DIDCommMsg
- func ParseDIDCommMsg(msg interface{}) (*DIDCommMsg, error)
- func ParseDIDCommMsgFromBytes(msg []byte, amount int64) (*DIDCommMsg, error)
- type DIDCommTransport
- type DIDCommTransportType
- type EncryptedMsg
- type EncryptedMsgDetailsBody
- type ForwardMsgBody
- type HttpComm
- type HttpCommConfig
- type IncomingDIDMessage
- type MessageSettings
- type SignedMsg
- type WebsocketComm
- type WebsocketCommConfig
Constants ¶
const BASIC_MSG_TYPE = "https://didcomm.org/basicmessage/2.0/message"
const (
CallbackAssociateDIDType = "DID"
)
const ENCRYPTED_MSG_TYP = "application/didcomm-encrypted+json"
const ENCRYPTED_MSG_TYPE = "https://impervious.ai/didcomm/encryptedmessage/1.0/message"
const PLAIN_MSG_TYP = "application/didcomm-plain+json"
const ROUTING_MSG_TYPE = "https://didcomm.org/routing/2.0"
const SERVICE_ENDPOINT_DIDCOMM_MESSAGING_TYPE = "DIDCommMessaging"
const VERIFICATION_METHOD_JSON_WEBKEY_TYPE = "JsonWebKey2020"
Variables ¶
This section is empty.
Functions ¶
func ParseDIDEncryptionKeys ¶
func ParseDIDEncryptionKeys(vms []did.Verification) ([]ecdsa.PublicKey, error)
ParseDIDEncryptionKeys will parse a DID Document's verification keys and look for keys that we support for encrypting to. Right now that's just P-384 elliptic keys.
func ParseDIDEndpoints ¶
func ParseMsgFromBytes ¶
func ParseMsgFromReq ¶
func ParseMsgFromReq(msg io.ReadCloser) (interface{}, error)
func PriortizeEndpoints ¶
func PriortizeEndpoints(endpoints []didCommEndpoint, amt int64, settings *MessageSettings) []didCommEndpoint
PriortizeEndpoints will reorder all of the endpoints to prioritize different types. Current order is WS, HTTP, LN. Different logic can be applied in the future.
Types ¶
type Attachment ¶
type Attachment struct {
ID string `json:"id"`
Description string `json:"description"`
MediaType string `json:"media_type"`
Data AttachmentData `json:"data"`
}
type AttachmentData ¶
type AttachmentData struct {
JSON interface{} `json:"json"`
}
type BasicMsgBody ¶
type BasicMsgBody struct {
Content string `json:"content"`
}
func ParseBasicMsgBody ¶
func ParseBasicMsgBody(msg interface{}) (*BasicMsgBody, error)
type CallbackAssociateDIDMessage ¶
type CallbackAssociateDIDMessage struct {
DID string
}
func ParseCallbackAssociateDIDTypeMessage ¶
func ParseCallbackAssociateDIDTypeMessage(message CallbackMessage) (*CallbackAssociateDIDMessage, error)
type CallbackMessage ¶
type CallbackMessage struct {
Type string
Message interface{}
}
type DIDComm ¶
type DIDComm interface {
SendMsg(*DIDCommMsg, int64, []id.Service, *MessageSettings) (string, error)
CheckSendMsg(*DIDCommMsg, int64, []id.Service, *MessageSettings) (bool, error)
CheckWebsocketConnections() ([]string, error)
Stop() error
}
func NewDIDComm ¶
func NewDIDComm(config *DIDCommConfig) (DIDComm, error)
type DIDCommConfig ¶
type DIDCommConfig struct {
IncomingDataChan chan IncomingDIDMessage
LightningManager DIDCommTransport
HttpComm DIDCommTransport
WebsocketDIDComm DIDCommTransport
Identity id.Identity
MessagesManager messages.MessageManager
}
type DIDCommMsg ¶
type DIDCommMsg struct {
Typ string `json:"typ"`
ID string `json:"id"`
THID string `json:"thid"`
PTHID string `json:"pthid"`
Type string `json:"type"` // Application/consumer specific
From string `json:"from"`
To []string `json:"to"`
CreatedTime int64 `json:"created_time"`
ExpiresTime int64 `json:"expires_time"`
Body interface{} `json:"body"` // Body structure depends on Type
Attachments []Attachment `json:"attachments"`
// Internal metadata just for Impervious use
InternalMetadata map[string]interface{} `json:"internal_metadata"` // TODO do not export when sending across the wire
}
func NewBasicMsg ¶
func NewBasicMsg(content string) *DIDCommMsg
func NewDIDCommMsg ¶
func NewDIDCommMsg() *DIDCommMsg
NewDIDCommMsg creates the base of a new DIDComm Message type. Additional parameters will need to be put in based on its use.
func NewEncryptedMsg ¶
func NewEncryptedMsg(encryptedMsg *EncryptedMsg, from, to string) *DIDCommMsg
func NewForwardMsg ¶
func NewForwardMsg(msgToForward interface{}, from, to, typ string) *DIDCommMsg
func ParseDIDCommMsg ¶
func ParseDIDCommMsg(msg interface{}) (*DIDCommMsg, error)
func ParseDIDCommMsgFromBytes ¶
func ParseDIDCommMsgFromBytes(msg []byte, amount int64) (*DIDCommMsg, error)
func (*DIDCommMsg) AddAmountMetadata ¶
func (s *DIDCommMsg) AddAmountMetadata(amt int64)
func (*DIDCommMsg) AddWebsocketId ¶
func (s *DIDCommMsg) AddWebsocketId(websocketId string)
func (*DIDCommMsg) GetAmountMetadata ¶
func (s *DIDCommMsg) GetAmountMetadata() int64
func (*DIDCommMsg) GetWebsocketId ¶
func (s *DIDCommMsg) GetWebsocketId() string
type DIDCommTransport ¶
type DIDCommTransport interface {
SendData(endpoint string, msgData *DIDCommMsg) error
CheckMsg(endpoint string, msgData *DIDCommMsg) bool
}
type DIDCommTransportType ¶
type DIDCommTransportType int
const ( DIDCommTransportHttp DIDCommTransportType = iota + 1 DIDCommTransportLightning DIDCommTransportWebsocket )
type EncryptedMsg ¶
type EncryptedMsg struct {
Ciphertext string `json:"ciphertext"`
Protected string `json:"protected"`
Tag string `json:"tag"`
Iv string `json:"iv"`
}
Encrypted Messaging
func ParseEncryptedMsg ¶
func ParseEncryptedMsg(msg interface{}) (*EncryptedMsg, error)
type EncryptedMsgDetailsBody ¶
type EncryptedMsgDetailsBody struct {
AttachmentId string `json:"attachment_id"`
}
Encrypted attachment messaging
func ParseEncryptedMsgDetailsBody ¶
func ParseEncryptedMsgDetailsBody(msg interface{}) (*EncryptedMsgDetailsBody, error)
type HttpComm ¶
type HttpComm interface {
SendData(endpoint string, msg *DIDCommMsg) error
CheckMsg(endpoint string, msg *DIDCommMsg) bool
Stop() error
ServeHTTP(res http.ResponseWriter, req *http.Request)
}
HttpComm is the transport mechanism for sending and receiving DIDComm messages over an http socket.
func NewHttpComm ¶
func NewHttpComm(cfg *HttpCommConfig) (HttpComm, error)
type HttpCommConfig ¶
type HttpCommConfig struct {
IncomingDataChan chan IncomingDIDMessage
}
type IncomingDIDMessage ¶
type IncomingDIDMessage struct {
Message interface{}
Callback *func(CallbackMessage) error
}
type MessageSettings ¶
type SignedMsg ¶
type SignedMsg struct {
Payload string `json:"payload"`
Protected string `json:"protected"`
Signature string `json:"signature"`
}
func ParseSignedMsg ¶
type WebsocketComm ¶
type WebsocketComm interface {
SendData(endpoint string, msg *DIDCommMsg) error
CheckMsg(endpoint string, msgData *DIDCommMsg) bool
Stop() error
ServeHTTP(res http.ResponseWriter, req *http.Request)
ConnectedClients() []string
}
WebsocketComm is the transport mechanism for sending and receiving DIDComm messages over websockets.
func NewWebsocketComm ¶
func NewWebsocketComm(cfg *WebsocketCommConfig) (WebsocketComm, error)
type WebsocketCommConfig ¶
type WebsocketCommConfig struct {
IncomingDataChan chan IncomingDIDMessage
}