presentproof

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name defines the protocol name.
	Name = "present-proof"
	// Spec defines the protocol spec.
	Spec = "https://didcomm.org/present-proof/2.0/"
	// ProposePresentationMsgType defines the protocol propose-presentation message type.
	ProposePresentationMsgType = Spec + "propose-presentation"
	// RequestPresentationMsgType defines the protocol request-presentation message type.
	RequestPresentationMsgType = Spec + "request-presentation"
	// PresentationMsgType defines the protocol presentation message type.
	PresentationMsgType = Spec + "presentation"
	// AckMsgType defines the protocol ack message type.
	AckMsgType = Spec + "ack"
	// ProblemReportMsgType defines the protocol problem-report message type.
	ProblemReportMsgType = Spec + "problem-report"
	// PresentationPreviewMsgType defines the protocol presentation-preview inner object type.
	PresentationPreviewMsgType = Spec + "presentation-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 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 Handler

type Handler interface {
	Handle(metadata Metadata) error
}

Handler describes middleware interface.

type HandlerFunc

type HandlerFunc func(metadata Metadata) error

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 Metadata

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() *Presentation
	// ProposePresentation is pointer to the message provided by the user through the Continue function.
	ProposePresentation() *ProposePresentation
	// RequestPresentation is pointer to the message provided by the user through the Continue function.
	RequestPresentation() *RequestPresentation
	// 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{}
}

Metadata provides helpful information for the processing.

type Middleware

type Middleware func(next Handler) Handler

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 WithFriendlyNames

func WithFriendlyNames(names ...string) Opt

WithFriendlyNames allows providing names for the presentations.

func WithPresentation

func WithPresentation(msg *Presentation) Opt

WithPresentation allows providing Presentation message USAGE: This message can be provided after receiving a Request message.

func WithProposePresentation

func WithProposePresentation(msg *ProposePresentation) Opt

WithProposePresentation allows providing ProposePresentation message USAGE: This message can be provided after receiving a Request message.

func WithRequestPresentation

func WithRequestPresentation(msg *RequestPresentation) Opt

WithRequestPresentation allows providing RequestPresentation message USAGE: This message can be provided after receiving a propose message.

type Presentation

type Presentation struct {
	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"`
}

Presentation is a response to a RequestPresentation message and contains signed presentations. TODO: Add ~please_ack decorator support for the protocol [Issue #2047].

type ProposePresentation

type ProposePresentation struct {
	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"`
	// FilterAttach 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.
	ProposalAttach []decorator.Attachment `json:"proposal~attach,omitempty"`
}

ProposePresentation 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 Provider

type Provider interface {
	Messenger() service.Messenger
	StorageProvider() storage.Provider
}

Provider contains dependencies for the protocol and is typically created by using aries.Context().

type RequestPresentation

type RequestPresentation struct {
	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"`
}

RequestPresentation describes values that need to be revealed and predicates that need to be fulfilled.

type Service

type Service struct {
	service.Action
	service.Message
	// contains filtered or unexported fields
}

Service for the presentproof protocol.

func New

func New(p Provider) (*Service, error)

New returns the presentproof service.

func (*Service) Accept

func (s *Service) Accept(msgType string) bool

Accept msg checks the msg type.

func (*Service) ActionContinue

func (s *Service) ActionContinue(piID string, opt Opt) error

ActionContinue allows proceeding with the action by the piID.

func (*Service) ActionStop

func (s *Service) ActionStop(piID string, cErr error) error

ActionStop allows stopping the action by the piID.

func (*Service) Actions

func (s *Service) Actions() ([]Action, error)

Actions returns actions for the async usage.

func (*Service) HandleInbound

func (s *Service) HandleInbound(msg service.DIDCommMsg, myDID, theirDID string) (string, error)

HandleInbound handles inbound message (presentproof protocol).

func (*Service) HandleOutbound

func (s *Service) HandleOutbound(_ service.DIDCommMsg, _, _ string) (string, error)

HandleOutbound handles outbound message (presentproof protocol).

func (*Service) Name

func (s *Service) Name() string

Name returns service name.

func (*Service) Use

func (s *Service) Use(items ...Middleware)

Use allows providing middlewares.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL