Documentation
¶
Index ¶
- Constants
- Variables
- type Content
- type DescriptionL10N
- type ImgAttach
- type InvitationEnvelope
- type PleaseIntroduceTo
- type Proposal
- type Provider
- type Recipient
- type Request
- type Response
- type Service
- func (s *Service) Accept(msgType string) bool
- func (s *Service) HandleInbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)
- func (s *Service) HandleOutbound(msg service.DIDCommMsg, myDID, theirDID string) error
- func (s *Service) InvitationReceived(msg service.StateMsg) error
- func (s *Service) Name() string
- func (s *Service) Stop() error
- type To
Constants ¶
const ( // Introduce protocol name Introduce = "introduce" // IntroduceSpec defines the introduce spec IntroduceSpec = "https://didcomm.org/introduce/1.0/" // ProposalMsgType defines the introduce proposal message type. ProposalMsgType = IntroduceSpec + "proposal" // RequestMsgType defines the introduce request message type. RequestMsgType = IntroduceSpec + "request" // ResponseMsgType defines the introduce response message type. ResponseMsgType = IntroduceSpec + "response" // AckMsgType defines the introduce ack message type. AckMsgType = IntroduceSpec + "ack" // ProblemReportMsgType defines the introduce problem-report message type. ProblemReportMsgType = IntroduceSpec + "problem-report" )
Variables ¶
var ( // ErrServerWasStopped an error message to determine whether service was stopped or not ErrServerWasStopped = errors.New("server was already stopped") )
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content struct {
Link string `json:"link,omitempty"`
ByteCount int `json:"byte_count,omitempty"`
Sha256 string `json:"sha256,omitempty"`
}
Content keeps image data
type DescriptionL10N ¶
DescriptionL10N may contain locale field and key->val pair for translation e.g { "locale": "en", "es": "Donde se toma el MRI; no en el centro"}, where locale field tells that field Description form To struct has en translation
func (DescriptionL10N) Locale ¶
func (d DescriptionL10N) Locale() string
Locale returns locale for the specified description (To.Description)
type ImgAttach ¶
type ImgAttach struct {
Description string `json:"description,omitempty"`
MimeType string `json:"mime-type,omitempty"`
Filename string `json:"filename,omitempty"`
Content Content `json:"content,omitempty"`
}
ImgAttach represent information about the image
type InvitationEnvelope ¶ added in v0.1.1
type InvitationEnvelope interface {
Invitation() *didexchange.Invitation
Recipients() []*Recipient
}
InvitationEnvelope provides necessary information to the service through Continue(InvitationEnvelope) function. Dependency is fully controlled by the end-user, the correct logic is to provide the same interface during the state machine execution, interface depends on the participant. e.g We have introducer and two introducees, this is the usual flow. Dependency interfaces are different and depend on the participant. - Recipients length is 2 and Invitation is <nil> (introducer) - Recipients length is 0 and Invitation is not <nil> (introducee) - Recipients length is 0 and Invitation is <nil> (introducee)
Correct usage is described below: - Recipients length is 0 and Invitation is <nil> (introducee) - Recipients length is 0 and Invitation is not <nil> (introducee) - Recipients length is 2 and Invitation is <nil> (introducer) - Recipients length is 1 and Invitation is not <nil> (introducer) NOTE: The state machine logic depends on the combinations above.
type PleaseIntroduceTo ¶
type PleaseIntroduceTo struct {
// nolint: staticcheck
To `json:",squash"`
}
PleaseIntroduceTo includes all field from To structure also it has Discovered the field which should be provided by help-me-discover protocol
type Proposal ¶
type Proposal struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
To *To `json:"to,omitempty"`
NWise bool `json:"nwise,omitempty"`
Thread *decorator.Thread `json:"~thread,omitempty"`
Timing *decorator.Timing `json:"~timing,omitempty"`
}
Proposal defines proposal request
type Provider ¶ added in v0.1.1
type Provider interface {
Messenger() service.Messenger
StorageProvider() storage.Provider
Service(id string) (interface{}, error)
}
Provider contains dependencies for the DID exchange protocol and is typically created by using aries.Context()
type Recipient ¶ added in v0.1.1
type Recipient struct {
To *To
MyDID string `json:"my_did,omitempty"`
TheirDID string `json:"their_did,omitempty"`
}
Recipient keeps information needed for the service 'To' field is needed for the proposal message 'MyDID' and 'TheirDID' fields are needed for sending messages e.g report-problem, proposal, ack etc.
type Request ¶
type Request struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
PleaseIntroduceTo *PleaseIntroduceTo `json:"please_introduce_to,omitempty"`
NWise bool `json:"nwise,omitempty"`
Timing *decorator.Timing `json:"~timing,omitempty"`
}
Request is not part of any state machine, it can be sent at any time, and when it is received, the recipient can choose whether or not to honor it in their own way TODO: need to clarify about decorator ~please_ack and problem_report
should Request contain those fields? What type it should be for each field?
type Response ¶
type Response struct {
Type string `json:"@type,omitempty"`
ID string `json:"@id,omitempty"`
Thread *decorator.Thread `json:"~thread,omitempty"`
Approve bool `json:"approve,omitempty"`
Invitation *didexchange.Invitation `json:"invitation,omitempty"`
}
Response message that introducee usually sends in response to an introduction proposal
type Service ¶
Service for introduce protocol
func (*Service) HandleInbound ¶
HandleInbound handles inbound message (introduce protocol)
func (*Service) HandleOutbound ¶
func (s *Service) HandleOutbound(msg service.DIDCommMsg, myDID, theirDID string) error
HandleOutbound handles outbound message (introduce protocol)
func (*Service) InvitationReceived ¶ added in v0.1.1
InvitationReceived is used to finish the state machine the function should be called by didexchange after receiving an invitation
type To ¶
type To struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DescriptionL10N DescriptionL10N `json:"description~l10n,omitempty"`
Where string `json:"where,omitempty"`
ImgAttach ImgAttach `json:"img~attach,omitempty"`
Proposed bool `json:"proposed,omitempty"`
}
To introducee descriptor keeps information about the introduction e.g introducer wants to introduce Bot to introducee { "name": "Bob" }