issuecredential

package
v0.1.3-0...-617a0de Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name defines the protocol name
	Name = "issue-credential"
	// Spec defines the protocol spec
	Spec = "https://didcomm.org/issue-credential/1.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 state machine identifier
	PIID string
	Msg  service.DIDCommMsgMap
}

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 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"`
	// 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 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"`
	// 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 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

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"`
	// SchemaIssuerDid is an optional filter to request credential based on a particular Schema issuer DID.
	SchemaIssuerDid string `json:"schema_issuer_did,omitempty"`
	// SchemaID is an optional filter to request credential based on a particular Schema.
	// This might be helpful when requesting a version 1 passport instead of a version 2 passport, for example.
	SchemaID string `json:"schema_id,omitempty"`
	// SchemaName is an optional filter to request credential based on a schema name.
	// This is useful to allow a more user-friendly experience of requesting a credential by schema name.
	SchemaName string `json:"schema_name,omitempty"`
	// SchemaVersion is an optional filter to request credential based on a schema version.
	// This is useful to allow a more user-friendly experience of requesting a credential by schema name and version.
	SchemaVersion string `json:"schema_version,omitempty"`
	// CredDefID is an optional filter to request credential based on a particular Credential Definition.
	// This might be helpful when requesting a commercial driver's license instead of
	// an ordinary driver's license, for example.
	CredDefID string `json:"cred_def_id,omitempty"`
	// IssuerDid is an optional filter to request a credential issued by the owner of a particular DID.
	IssuerDid string `json:"issuer_did,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

type Provider interface {
	Messenger() service.Messenger
	StorageProvider() storage.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"`
	// 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

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

Service for the issuecredential protocol

func New

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

New returns the issuecredential 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 (issuecredential protocol)

func (*Service) HandleOutbound

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

HandleOutbound handles outbound message (issuecredential 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