presentproof

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 12 Imported by: 22

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/1.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                `json:"piid"`
	Msg  service.DIDCommMsgMap `json:"msg"`
}

Action contains helpful information about action

type Attribute

type Attribute struct {
	Name      string `json:"name"`
	CredDefID string `json:"cred_def_id"`
	MimeType  string `json:"mime-type,omitempty"`
	Value     string `json:"value"`
	Referent  string `json:"referent"`
}

Attribute describes an attribute for the PresentationPreview

type Opt

type Opt func(md *metaData)

Opt describes option signature for the Continue function

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 Predicate

type Predicate struct {
	Name      string `json:"name"`
	CredDefID string `json:"cred_def_id"`
	Predicate string `json:"predicate"`
	Threshold string `json:"threshold"`
}

Predicate describes a predicate for the PresentationPreview

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"`
	// Presentations is a slice of attachments containing the presentation in the requested format(s).
	Presentations []decorator.Attachment `json:"presentations~attach,omitempty"`
}

Presentation is a response to a RequestPresentation message and contains signed presentations.

type PresentationPreview

type PresentationPreview struct {
	Type       string      `json:"@type,omitempty"`
	Attributes []Attribute `json:"attributes,omitempty"`
	Predicates []Predicate `json:"predicates,omitempty"`
}

PresentationPreview is used to construct a preview of the data for the presentation.

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"`
	// PresentationProposal is a JSON-LD object that represents the presentation example that Prover wants to provide.
	PresentationProposal PresentationPreview `json:"presentation_proposal,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.

type Provider

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

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"`
	// RequestPresentations is a slice of attachments defining the acceptable formats for the presentation.
	RequestPresentations []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) error

HandleOutbound handles outbound message (presentproof protocol)

func (*Service) Name

func (s *Service) Name() string

Name returns service name

Jump to

Keyboard shortcuts

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