Documentation ¶
Index ¶
- Constants
- type Action
- type Format
- type Handler
- type HandlerFunc
- type Metadata
- type Middleware
- type Opt
- func WithAddProofFn(addProof func(presentation *verifiable.Presentation) error) Opt
- func WithFriendlyNames(names ...string) Opt
- func WithMultiOptions(opts ...Opt) Opt
- func WithPresentation(pp *PresentationParams) Opt
- func WithProperties(props map[string]interface{}) Opt
- func WithProposePresentation(pp *ProposePresentationParams) Opt
- func WithRequestPresentation(msg *RequestPresentationParams) Opt
- type PresentationParams
- func (p *PresentationParams) AsV2() *PresentationV2
- func (p *PresentationParams) AsV3() *PresentationV3
- func (p *PresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
- func (p *PresentationParams) FromV2(v2 *PresentationV2)
- func (p *PresentationParams) FromV3(v3 *PresentationV3)
- func (p *PresentationParams) UnmarshalJSON(b []byte) error
- type PresentationV2
- type PresentationV3
- type PresentationV3Body
- type ProposePresentationParams
- func (p *ProposePresentationParams) AsV2() *ProposePresentationV2
- func (p *ProposePresentationParams) AsV3() *ProposePresentationV3
- func (p *ProposePresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
- func (p *ProposePresentationParams) FromV2(v2 *ProposePresentationV2)
- func (p *ProposePresentationParams) FromV3(v3 *ProposePresentationV3)
- func (p *ProposePresentationParams) UnmarshalJSON(b []byte) error
- type ProposePresentationV2
- type ProposePresentationV3
- type ProposePresentationV3Body
- type Provider
- type RequestPresentationParams
- func (p *RequestPresentationParams) AsV2() *RequestPresentationV2
- func (p *RequestPresentationParams) AsV3() *RequestPresentationV3
- func (p *RequestPresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
- func (p *RequestPresentationParams) FromV2(v2 *RequestPresentationV2)
- func (p *RequestPresentationParams) FromV3(v3 *RequestPresentationV3)
- func (p *RequestPresentationParams) UnmarshalJSON(b []byte) error
- type RequestPresentationV2
- type RequestPresentationV3
- type RequestPresentationV3Body
- type Service
- func (s *Service) Accept(msgType string) bool
- func (s *Service) ActionContinue(piID string, opts ...Opt) error
- func (s *Service) ActionStop(piID string, cErr error, opts ...Opt) error
- func (s *Service) Actions() ([]Action, error)
- func (s *Service) HandleInbound(msg service.DIDCommMsg, ctx service.DIDCommContext) (string, error)
- func (s *Service) HandleOutbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)
- func (s *Service) Initialize(prov interface{}) error
- func (s *Service) Name() string
- func (s *Service) Use(items ...Middleware)
Constants ¶
const ( // Name defines the protocol name. Name = "present-proof" // SpecV2 defines the protocol spec. SpecV2 = "https://didcomm.org/present-proof/2.0/" // ProposePresentationMsgTypeV2 defines the protocol propose-presentation message type. ProposePresentationMsgTypeV2 = SpecV2 + "propose-presentation" // RequestPresentationMsgTypeV2 defines the protocol request-presentation message type. RequestPresentationMsgTypeV2 = SpecV2 + "request-presentation" // PresentationMsgTypeV2 defines the protocol presentation message type. PresentationMsgTypeV2 = SpecV2 + "presentation" // AckMsgTypeV2 defines the protocol ack message type. AckMsgTypeV2 = SpecV2 + "ack" // ProblemReportMsgTypeV2 defines the protocol problem-report message type. ProblemReportMsgTypeV2 = SpecV2 + "problem-report" // PresentationPreviewMsgTypeV2 defines the protocol presentation-preview inner object type. PresentationPreviewMsgTypeV2 = SpecV2 + "presentation-preview" // SpecV3 defines the protocol spec. SpecV3 = "https://didcomm.org/present-proof/3.0/" // ProposePresentationMsgTypeV3 defines the protocol propose-presentation message type. ProposePresentationMsgTypeV3 = SpecV3 + "propose-presentation" // RequestPresentationMsgTypeV3 defines the protocol request-presentation message type. RequestPresentationMsgTypeV3 = SpecV3 + "request-presentation" // PresentationMsgTypeV3 defines the protocol presentation message type. PresentationMsgTypeV3 = SpecV3 + "presentation" // AckMsgTypeV3 defines the protocol ack message type. AckMsgTypeV3 = SpecV3 + "ack" // ProblemReportMsgTypeV3 defines the protocol problem-report message type. ProblemReportMsgTypeV3 = SpecV3 + "problem-report" // PresentationPreviewMsgTypeV3 defines the protocol presentation-preview inner object type. PresentationPreviewMsgTypeV3 = SpecV3 + "presentation-preview" )
const ( // StateNameAbandoned is present proof protocol state 'abandoned'. StateNameAbandoned = "abandoned" // StateNameDone is present proof protocol state 'done'. StateNameDone = "done" )
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 Format ¶ added in v0.1.4
type Format struct { AttachID string `json:"attach_id,omitempty"` Format string `json:"format,omitempty"` }
Format contains the value of the attachment @id and the verifiable credential format of the attachment.
type HandlerFunc ¶ added in v0.1.4
HandlerFunc is a helper type which implements the middleware Handler interface.
func (HandlerFunc) Handle ¶ added in v0.1.4
func (hf HandlerFunc) Handle(metadata Metadata) error
Handle implements function to satisfy the Handler interface.
type Metadata ¶ added in v0.1.4
type Metadata interface { // Message contains the original inbound/outbound message Message() service.DIDCommMsg // Presentation is pointer to the message provided by the user through the Continue function. Presentation() *PresentationV2 // ProposePresentation is pointer to the message provided by the user through the Continue function. ProposePresentation() *ProposePresentationV2 // RequestPresentation is pointer to the message provided by the user through the Continue function. RequestPresentation() *RequestPresentationV2 // PresentationV3 is pointer to the message provided by the user through the Continue function. PresentationV3() *PresentationV3 // ProposePresentationV3 is pointer to the message provided by the user through the Continue function. ProposePresentationV3() *ProposePresentationV3 // RequestPresentationV3 is pointer to the message provided by the user through the Continue function. RequestPresentationV3() *RequestPresentationV3 // PresentationNames is a slice which contains presentation names provided by the user through the Continue function. PresentationNames() []string // StateName provides the state name StateName() string // Properties provides the possibility to set properties Properties() map[string]interface{} // GetAddProofFn provides function to sign the Presentation. GetAddProofFn() func(presentation *verifiable.Presentation) error }
Metadata provides helpful information for the processing.
type Middleware ¶ added in v0.1.4
Middleware function receives next handler and returns handler that needs to be executed.
type Opt ¶
type Opt func(md *metaData)
Opt describes option signature for the Continue function.
func WithAddProofFn ¶ added in v0.1.6
func WithAddProofFn(addProof func(presentation *verifiable.Presentation) error) Opt
WithAddProofFn allows providing function that will sign the Presentation. USAGE: This fn can be provided after receiving a Invitation message.
func WithFriendlyNames ¶ added in v0.1.4
WithFriendlyNames allows providing names for the presentations.
func WithMultiOptions ¶ added in v0.1.6
WithMultiOptions allows combining several options into one.
func WithPresentation ¶
func WithPresentation(pp *PresentationParams) Opt
WithPresentation allows providing Presentation message USAGE: This message can be provided after receiving an Invitation message.
func WithProperties ¶ added in v0.1.8
WithProperties allows providing custom properties.
func WithProposePresentation ¶
func WithProposePresentation(pp *ProposePresentationParams) Opt
WithProposePresentation allows providing ProposePresentation message USAGE: This message can be provided after receiving an Invitation message.
func WithRequestPresentation ¶
func WithRequestPresentation(msg *RequestPresentationParams) Opt
WithRequestPresentation allows providing RequestPresentation message USAGE: This message can be provided after receiving a propose message.
type PresentationParams ¶ added in v0.1.8
type PresentationParams struct { // Comment is a field that provides some human readable information about the provided presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300]. Comment string // Formats contains an entry for each presentations~attach array entry, providing the the value of the attachment // @id and the verifiable presentation format and version of the attachment. Formats []Format // Attachments is an array of attachments containing verifiable presentations. Attachments []decorator.GenericAttachment // GoalCode is an optional goal code to indicate the intended use of the provided presentation(s). GoalCode string }
PresentationParams holds the parameters for providing a presentation.
func (*PresentationParams) AsV2 ¶ added in v0.1.8
func (p *PresentationParams) AsV2() *PresentationV2
AsV2 translates this presentation message into a present-proof 2.0 presentation message.
func (*PresentationParams) AsV3 ¶ added in v0.1.8
func (p *PresentationParams) AsV3() *PresentationV3
AsV3 translates this presentation message into a present-proof 3.0 presentation message.
func (*PresentationParams) FromDIDCommMsgMap ¶ added in v0.1.8
func (p *PresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
FromDIDCommMsgMap implements service.MsgMapDecoder.
func (*PresentationParams) FromV2 ¶ added in v0.1.8
func (p *PresentationParams) FromV2(v2 *PresentationV2)
FromV2 initializes this presentation message from a present-proof 2.0 presentation message.
func (*PresentationParams) FromV3 ¶ added in v0.1.8
func (p *PresentationParams) FromV3(v3 *PresentationV3)
FromV3 initializes this presentation message from a present-proof 3.0 presentation message.
func (*PresentationParams) UnmarshalJSON ¶ added in v0.1.8
func (p *PresentationParams) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PresentationV2 ¶ added in v0.1.8
type PresentationV2 struct { ID string `json:"@id,omitempty"` Type string `json:"@type,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300]. Comment string `json:"comment,omitempty"` // Formats contains an entry for each presentations~attach array entry, providing the the value of the attachment // @id and the verifiable presentation format and version of the attachment. Formats []Format `json:"formats,omitempty"` // PresentationsAttach an array of attachments containing the presentation in the requested format(s). PresentationsAttach []decorator.Attachment `json:"presentations~attach,omitempty"` }
PresentationV2 is a response to a RequestPresentationV2 message and contains signed presentations. TODO: Add ~please_ack decorator support for the protocol [Issue #2047].
type PresentationV3 ¶ added in v0.1.7
type PresentationV3 struct { Type string `json:"type,omitempty"` Body PresentationV3Body `json:"body,omitempty"` // Attachments is an array of attachments that further define the presentation request being proposed. // This might be used to clarify which formats or format versions are wanted. Attachments []decorator.AttachmentV2 `json:"attachments,omitempty"` }
PresentationV3 is a response to a RequestPresentationV3 message and contains signed presentations.
type PresentationV3Body ¶ added in v0.1.7
type PresentationV3Body struct { GoalCode string `json:"goal_code,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` }
PresentationV3Body represents body for PresentationV3.
type ProposePresentationParams ¶ added in v0.1.8
type ProposePresentationParams struct { // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string // Formats contains an entry for each proposal~attach array entry, including an optional value of the // attachment @id (if attachments are present) and the verifiable presentation format and version of the attachment. Formats []Format GoalCode string // Attachments is an array of attachments that further define the presentation request being proposed. // This might be used to clarify which formats or format versions are wanted. Attachments []decorator.GenericAttachment }
ProposePresentationParams holds the parameters for proposing a presentation.
func (*ProposePresentationParams) AsV2 ¶ added in v0.1.8
func (p *ProposePresentationParams) AsV2() *ProposePresentationV2
AsV2 translates this presentation proposal into a present-proof 2.0 proposal message.
func (*ProposePresentationParams) AsV3 ¶ added in v0.1.8
func (p *ProposePresentationParams) AsV3() *ProposePresentationV3
AsV3 translates this presentation proposal into a present-proof 3.0 proposal message.
func (*ProposePresentationParams) FromDIDCommMsgMap ¶ added in v0.1.8
func (p *ProposePresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
FromDIDCommMsgMap implements service.MsgMapDecoder.
func (*ProposePresentationParams) FromV2 ¶ added in v0.1.8
func (p *ProposePresentationParams) FromV2(v2 *ProposePresentationV2)
FromV2 initializes this presentation proposal from a present-proof 2.0 proposal message.
func (*ProposePresentationParams) FromV3 ¶ added in v0.1.8
func (p *ProposePresentationParams) FromV3(v3 *ProposePresentationV3)
FromV3 initializes this presentation proposal from a present-proof 3.0 proposal message.
func (*ProposePresentationParams) UnmarshalJSON ¶ added in v0.1.8
func (p *ProposePresentationParams) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ProposePresentationV2 ¶ added in v0.1.8
type ProposePresentationV2 struct { ID string `json:"@id,omitempty"` Type string `json:"@type,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` // Formats contains an entry for each proposal~attach array entry, including an optional value of the // attachment @id (if attachments are present) and the verifiable presentation format and version of the attachment. Formats []Format `json:"formats,omitempty"` // ProposalsAttach is an array of attachments that further define the presentation request being proposed. // This might be used to clarify which formats or format versions are wanted. ProposalsAttach []decorator.Attachment `json:"proposals~attach,omitempty"` }
ProposePresentationV2 is an optional message sent by the prover to the verifier to initiate a proof presentation process, or in response to a request-presentation message when the prover wants to propose using a different presentation format or request.
type ProposePresentationV3 ¶ added in v0.1.7
type ProposePresentationV3 struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Body ProposePresentationV3Body `json:"body,omitempty"` // Attachments is an array of attachments that further define the presentation request being proposed. // This might be used to clarify which formats or format versions are wanted. Attachments []decorator.AttachmentV2 `json:"attachments,omitempty"` }
ProposePresentationV3 is an optional message sent by the prover to the verifier to initiate a proof presentation process, or in response to a request-presentation message when the prover wants to propose using a different presentation format or request.
type ProposePresentationV3Body ¶ added in v0.1.7
type ProposePresentationV3Body struct { GoalCode string `json:"goal_code,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` }
ProposePresentationV3Body represents body for ProposePresentationV3.
type Provider ¶
Provider contains dependencies for the protocol and is typically created by using aries.Context().
type RequestPresentationParams ¶ added in v0.1.8
type RequestPresentationParams struct { // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string // WillConfirm is a field that defaults to "false" to indicate that the verifier will or will not // send a post-presentation confirmation ack message. WillConfirm bool // Formats contains an entry for each request_presentations~attach array entry, providing the the value of the // attachment @id and the verifiable presentation request format and version of the attachment. Formats []Format // Attachments is an array of attachments containing the acceptable verifiable presentation requests. Attachments []decorator.GenericAttachment // GoalCode is an optional goal code to indicate the desired use of the requested presentation. GoalCode string }
RequestPresentationParams holds the parameters for requesting a presentation.
func (*RequestPresentationParams) AsV2 ¶ added in v0.1.8
func (p *RequestPresentationParams) AsV2() *RequestPresentationV2
AsV2 translates this presentation request into a present-proof 2.0 request message.
func (*RequestPresentationParams) AsV3 ¶ added in v0.1.8
func (p *RequestPresentationParams) AsV3() *RequestPresentationV3
AsV3 translates this presentation request into a present-proof 3.0 request message.
func (*RequestPresentationParams) FromDIDCommMsgMap ¶ added in v0.1.8
func (p *RequestPresentationParams) FromDIDCommMsgMap(msgMap service.DIDCommMsgMap) error
FromDIDCommMsgMap implements service.MsgMapDecoder.
func (*RequestPresentationParams) FromV2 ¶ added in v0.1.8
func (p *RequestPresentationParams) FromV2(v2 *RequestPresentationV2)
FromV2 initializes this presentation request from a present-proof 2.0 request message.
func (*RequestPresentationParams) FromV3 ¶ added in v0.1.8
func (p *RequestPresentationParams) FromV3(v3 *RequestPresentationV3)
FromV3 initializes this presentation request from a present-proof 3.0 request message.
func (*RequestPresentationParams) UnmarshalJSON ¶ added in v0.1.8
func (p *RequestPresentationParams) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RequestPresentationV2 ¶ added in v0.1.8
type RequestPresentationV2 struct { ID string `json:"@id,omitempty"` Type string `json:"@type,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` // WillConfirm is a field that defaults to "false" to indicate that the verifier will or will not // send a post-presentation confirmation ack message. WillConfirm bool `json:"will_confirm,omitempty"` // Formats contains an entry for each request_presentations~attach array entry, providing the the value of the // attachment @id and the verifiable presentation request format and version of the attachment. Formats []Format `json:"formats,omitempty"` // RequestPresentationsAttach is an array of attachments containing the acceptable verifiable presentation requests. RequestPresentationsAttach []decorator.Attachment `json:"request_presentations~attach,omitempty"` }
RequestPresentationV2 describes values that need to be revealed and predicates that need to be fulfilled.
type RequestPresentationV3 ¶ added in v0.1.7
type RequestPresentationV3 struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Body RequestPresentationV3Body `json:"body,omitempty"` // Attachments is an array of attachments containing the acceptable verifiable presentation requests. Attachments []decorator.AttachmentV2 `json:"attachments,omitempty"` }
RequestPresentationV3 describes values that need to be revealed and predicates that need to be fulfilled.
type RequestPresentationV3Body ¶ added in v0.1.7
type RequestPresentationV3Body struct { GoalCode string `json:"goal_code,omitempty"` // Comment is a field that provides some human readable information about the proposed presentation. // TODO: Should follow DIDComm conventions for l10n. [Issue #1300] Comment string `json:"comment,omitempty"` // WillConfirm is a field that defaults to "false" to indicate that the verifier will or will not // send a post-presentation confirmation ack message. WillConfirm bool `json:"will_confirm,omitempty"` }
RequestPresentationV3Body represents body for RequestPresentationV3.
type Service ¶
Service for the presentproof 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 ¶
func (s *Service) HandleInbound(msg service.DIDCommMsg, ctx service.DIDCommContext) (string, error)
HandleInbound handles inbound message (presentproof protocol).
func (*Service) HandleOutbound ¶
HandleOutbound handles outbound message (presentproof protocol).
func (*Service) Initialize ¶ added in v0.1.8
Initialize initializes the Service. If Initialize succeeds, any further call is a no-op.
func (*Service) Use ¶ added in v0.1.4
func (s *Service) Use(items ...Middleware)
Use allows providing middlewares.