Documentation ¶
Index ¶
- Constants
- type Action
- type Attribute
- type Format
- type Handler
- type HandlerFunc
- type IssueCredential
- type Metadata
- type Middleware
- type OfferCredential
- type Opt
- type PreviewCredential
- type ProposeCredential
- type Provider
- type RequestCredential
- type Service
- func (s *Service) Accept(msgType string) bool
- func (s *Service) ActionContinue(piID string, opt Opt) error
- func (s *Service) ActionStop(piID string, cErr error) error
- func (s *Service) Actions() ([]Action, error)
- func (s *Service) HandleInbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)
- func (s *Service) HandleOutbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)
- func (s *Service) Name() string
- func (s *Service) Use(items ...Middleware)
Constants ¶
const ( // Name defines the protocol name. Name = "issue-credential" // Spec defines the protocol spec. Spec = "https://didcomm.org/issue-credential/2.0/" // ProposeCredentialMsgType defines the protocol propose-credential message type. ProposeCredentialMsgType = Spec + "propose-credential" // OfferCredentialMsgType defines the protocol offer-credential message type. OfferCredentialMsgType = Spec + "offer-credential" // RequestCredentialMsgType defines the protocol request-credential message type. RequestCredentialMsgType = Spec + "request-credential" // IssueCredentialMsgType defines the protocol issue-credential message type. IssueCredentialMsgType = Spec + "issue-credential" // AckMsgType defines the protocol ack message type. AckMsgType = Spec + "ack" // ProblemReportMsgType defines the protocol problem-report message type. ProblemReportMsgType = Spec + "problem-report" // CredentialPreviewMsgType defines the protocol credential-preview inner object type. CredentialPreviewMsgType = Spec + "credential-preview" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // Protocol instance ID PIID string Msg service.DIDCommMsgMap MyDID string TheirDID string }
Action contains helpful information about action.
type Attribute ¶
type Attribute struct { Name string `json:"name,omitempty"` MimeType string `json:"mime-type,omitempty"` Value string `json:"value,omitempty"` }
Attribute describes an attribute for a Preview Credential.
type Format ¶
type Format struct { AttachID string `json:"attach_id,omitempty"` Format string `json:"format,omitempty"` }
Format contains the the value of the attachment @id and the verifiable credential format of the attachment.
type HandlerFunc ¶
HandlerFunc is a helper type which implements the middleware Handler interface.
func (HandlerFunc) Handle ¶
func (hf HandlerFunc) Handle(metadata Metadata) error
Handle implements function to satisfy the Handler interface.
type IssueCredential ¶
type IssueCredential struct { Type string `json:"@type,omitempty"` // Comment is an optional field that provides human readable information about this Credential Offer, // so the offer can be evaluated by human judgment. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300]. Comment string `json:"comment,omitempty"` // Formats contains an entry for each credentials~attach array entry, providing the the value // of the attachment @id and the verifiable credential format and version of the attachment. Formats []Format `json:"formats,omitempty"` // CredentialsAttach is a slice of attachments containing the issued credentials. CredentialsAttach []decorator.Attachment `json:"credentials~attach,omitempty"` }
IssueCredential contains as attached payload the credentials being issued and is sent in response to a valid Request Credential message. TODO: Need to add ~please-ack decorator [Issue #1299].
type Metadata ¶
type Metadata interface { // Message contains the original inbound/outbound message Message() service.DIDCommMsg // OfferCredential is pointer to the message provided by the user through the Continue function. OfferCredential() *OfferCredential // ProposeCredential is pointer to the message provided by the user through the Continue function. ProposeCredential() *ProposeCredential // IssueCredential is pointer to the message provided by the user through the Continue function. IssueCredential() *IssueCredential // RequestCredential is pointer to message provided by the user through the Continue function. RequestCredential() *RequestCredential // CredentialNames is a slice which contains credential names provided by the user through the Continue function. CredentialNames() []string // StateName provides the state name StateName() string // Properties provides the possibility to set properties Properties() map[string]interface{} }
Metadata provides helpful information for the processing.
type Middleware ¶
Middleware function receives next handler and returns handler that needs to be executed.
type OfferCredential ¶
type OfferCredential struct { Type string `json:"@type,omitempty"` // Comment is an optional field that provides human readable information about this Credential Offer, // so the offer can be evaluated by human judgment. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300]. Comment string `json:"comment,omitempty"` // CredentialPreview is a JSON-LD object that represents the credential data that Issuer is willing to issue. CredentialPreview PreviewCredential `json:"credential_preview,omitempty"` // Formats contains an entry for each offers~attach array entry, providing the the value // of the attachment @id and the verifiable credential format and version of the attachment. Formats []Format `json:"formats,omitempty"` // OffersAttach is a slice of attachments that further define the credential being offered. // This might be used to clarify which formats or format versions will be issued. OffersAttach []decorator.Attachment `json:"offers~attach,omitempty"` }
OfferCredential is a message sent by the Issuer to the potential Holder, describing the credential they intend to offer and possibly the price they expect to be paid. TODO: Need to add ~payment_request and ~timing.expires_time decorators [Issue #1297].
type Opt ¶
type Opt func(md *metaData)
Opt describes option signature for the Continue function.
func WithFriendlyNames ¶
WithFriendlyNames allows providing names for the credentials. USAGE: This function should be used when the Holder receives IssueCredential message.
func WithIssueCredential ¶
func WithIssueCredential(msg *IssueCredential) Opt
WithIssueCredential allows providing IssueCredential message USAGE: This message should be provided after receiving a RequestCredential message.
func WithOfferCredential ¶
func WithOfferCredential(msg *OfferCredential) Opt
WithOfferCredential allows providing OfferCredential message USAGE: This message should be provided after receiving a ProposeCredential message.
func WithProposeCredential ¶
func WithProposeCredential(msg *ProposeCredential) Opt
WithProposeCredential allows providing ProposeCredential message USAGE: This message should be provided after receiving an OfferCredential message.
func WithRequestCredential ¶
func WithRequestCredential(msg *RequestCredential) Opt
WithRequestCredential allows providing RequestCredential message USAGE: This message should be provided after receiving an OfferCredential message.
type PreviewCredential ¶
type PreviewCredential struct { Type string `json:"@type,omitempty"` Attributes []Attribute `json:"attributes,omitempty"` }
PreviewCredential is used to construct a preview of the data for the credential that is to be issued.
type ProposeCredential ¶
type ProposeCredential struct { Type string `json:"@type,omitempty"` // Comment is an optional field that provides human readable information about this Credential Offer, // so the offer can be evaluated by human judgment. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` // CredentialProposal is an optional JSON-LD object that represents // the credential data that the Prover wants to receive. CredentialProposal PreviewCredential `json:"credential_proposal,omitempty"` // Formats contains an entry for each filter~attach array entry, providing the the value of the attachment @id // and the verifiable credential format and version of the attachment. Formats []Format `json:"formats,omitempty"` // FilterAttach is an array of attachments that further define the credential being proposed. // This might be used to clarify which formats or format versions are wanted. FilterAttach []decorator.Attachment `json:"filter~attach,omitempty"` }
ProposeCredential is an optional message sent by the potential Holder to the Issuer to initiate the protocol or in response to a offer-credential message when the Holder wants some adjustments made to the credential data offered by Issuer.
type Provider ¶
Provider contains dependencies for the protocol and is typically created by using aries.Context().
type RequestCredential ¶
type RequestCredential struct { Type string `json:"@type,omitempty"` // Comment is an optional field that provides human readable information about this Credential Offer, // so the offer can be evaluated by human judgment. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300]. Comment string `json:"comment,omitempty"` // Formats contains an entry for each requests~attach array entry, providing the the value // of the attachment @id and the verifiable credential format and version of the attachment. Formats []Format `json:"formats,omitempty"` // RequestsAttach is a slice of attachments defining the requested formats for the credential RequestsAttach []decorator.Attachment `json:"requests~attach,omitempty"` }
RequestCredential is a message sent by the potential Holder to the Issuer, to request the issuance of a credential. Where circumstances do not require a preceding Offer Credential message (e.g., there is no cost to issuance that the Issuer needs to explain in advance, and there is no need for cryptographic negotiation), this message initiates the protocol. TODO: Need to add ~payment-receipt decorator [Issue #1298].
type Service ¶
Service for the issuecredential protocol.
func (*Service) ActionContinue ¶
ActionContinue allows proceeding with the action by the piID.
func (*Service) ActionStop ¶
ActionStop allows stopping the action by the piID.
func (*Service) HandleInbound ¶
HandleInbound handles inbound message (issuecredential protocol).
func (*Service) HandleOutbound ¶
HandleOutbound handles outbound message (issuecredential protocol).