presentation

package
v0.0.0-...-55a0270 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CredentialsLDContext = "https://w3.org/2018/credentials/v1"
	LDType               = "VerifiablePresentation"
)

Variables

This section is empty.

Functions

func CheckVCMatchesCriterion

func CheckVCMatchesCriterion(criterion Criterion, cred credential.VerifiableCredential, variables map[string]interface{}) error

CheckVCMatchesCriterion returns an error if the credential does not satisfy the given criterion.

func CheckVCsMatchCriterion

func CheckVCsMatchCriterion(criterion Criterion, credentials []credential.VerifiableCredential, variables map[string]interface{}) error

CheckVCsMatchCriterion returns an error if the credentials do not satisfy the given criterion.

Types

type AttributeReq

type AttributeReq struct {
	AttributeName string `json:"name"`
	Required      bool   `json:"required"`
}

AttributeReq is a request for a particular attribute, which can either be required or optional. In order for a credential to match the criterion, all required attributes must be included in the credential. The Holder may choose to include optional attributes at their discretion.

type CompositeProofRequest

type CompositeProofRequest struct {
	ProofReqRespMetadata
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Verifier    did.DID     `json:"verifier"`
	Criteria    []Criterion `json:"criteria"`
}

type CompositeProofRequestInstanceChallenge

type CompositeProofRequestInstanceChallenge struct {
	ProofRequestInstanceID string                 `json:"proofRequestInstanceId"`
	ProofResponseURL       string                 `json:"proofURL"`
	ProofRequest           *CompositeProofRequest `json:"proofRequest"`
	ConditionVariables     map[string]interface{} `json:"variables,omitempty"`
	Proof                  *proof.Proof           `json:"proof,omitempty"`
}

func (*CompositeProofRequestInstanceChallenge) GetProof

func (*CompositeProofRequestInstanceChallenge) SetProof

type CompositeProofRequestRecord

type CompositeProofRequestRecord struct {
	ID          string `json:"id"`
	CreatedDate string `json:"createdDate"`
	UpdatedDate string `json:"updatedDate"`
	PlatformProofRequestMetadata
	CompositeProofRequest
}

type CompositeProofRequestRecordDataHolder

type CompositeProofRequestRecordDataHolder struct {
	CompositeProofRequest CompositeProofRequestRecord `json:"compositeProofRequest"`
}

type CompositeProofResponseSubmission

type CompositeProofResponseSubmission struct {
	ProofReqRespMetadata
	ProofRequestInstanceID string               `json:"proofRequestInstanceId"`
	FulfilledCriteria      []FulfilledCriterion `json:"FulfilledCriteria"`
	Proof                  []*proof.Proof       `json:"proof,omitempty"`
}

func (*CompositeProofResponseSubmission) GetProof

These methods assume a single proof.

func (*CompositeProofResponseSubmission) SetProof

func (c *CompositeProofResponseSubmission) SetProof(pr *proof.Proof)

type CriteriaHolder

type CriteriaHolder struct {
	Index     int
	Criterion Criterion
	Variables map[string]interface{}
}

CriteriaHolder holds a Criterion, the index of that Criterion in the underlying CompositeProofRequest where the it was specified, and the set of variables used in any conditions.

func (*CriteriaHolder) CanFulfill

func (c *CriteriaHolder) CanFulfill(cred credential.VerifiableCredential) bool

CanFulfill checks whether a cred can satisfy a request

func (*CriteriaHolder) GetAuthorDID

func (c *CriteriaHolder) GetAuthorDID() did.DID

GetAuthorDID returns the schema author's decentralized identifier.

func (*CriteriaHolder) GetDescription

func (c *CriteriaHolder) GetDescription() string

GetDescription returns the criterion description.

func (*CriteriaHolder) GetFields

func (c *CriteriaHolder) GetFields() []AttributeReq

GetFields returns schema attributes.

func (*CriteriaHolder) GetMaxCreds

func (c *CriteriaHolder) GetMaxCreds() int

GetMaxCreds returns the maximum number of credentials that can be submitted for this criterion.

func (*CriteriaHolder) GetMinCreds

func (c *CriteriaHolder) GetMinCreds() int

GetMinCreds returns the minimum number of credentials that must be submitted for this criterion.

func (*CriteriaHolder) GetResourceID

func (c *CriteriaHolder) GetResourceID() string

GetResourceID returns the schema resource ID.

func (*CriteriaHolder) GetSchema

func (c *CriteriaHolder) GetSchema() string

GetSchema returns the schema ID.

type Criterion

type Criterion struct {
	Description  string                 `json:"description"`
	Reason       string                 `json:"reason"`
	Issuers      Issuers                `json:"issuers"`
	MaxRequired  int                    `json:"max"`
	MinRequired  int                    `json:"min"`
	AllowExpired *bool                  `json:"allowExpired,omitempty"`
	Schema       SchemaReq              `json:"schema"`
	Conditions   []conditions.Condition `json:"conditions,omitempty"`
}

Criterion is a data challenge for credentials of a particular schema type. Only credentials that match the schema and predicate conditions can be included in the challenge response. Additionally, the criterion can optionally place restrictions on the credential Issuers and the minimum/maximum number of credentials that must/can be supplied.

type FulfilledCriterion

type FulfilledCriterion struct {
	Criterion     Criterion      `json:"Criterion"`
	Presentations []Presentation `json:"Presentations"`
}

FulfilledCriterion holds a request Criterion and the list of all Proof Presentations that fulfilled that Criterion.

type GetCompositeProofRequestRequestResponse

type GetCompositeProofRequestRequestResponse struct {
	Data CompositeProofRequestRecordDataHolder `json:"data"`
}

GetCompositeProofRequestRequestResponse is a response payload for GET'ing a Composite Proof Request that has been stored in the platform.

type Issuers

type Issuers struct {
	DIDs []did.DID `json:"dids,omitempty"`
}

type PlatformProofRequestMetadata

type PlatformProofRequestMetadata struct {
	UserID string `json:"userId"`
	Name   string `json:"name"`
	// TODO add client id
	// ClientID	string `json:"clientId`
	CallbackURL did.URI `json:"callbackURL"`
}

type PostCompositeProofRequestRequest

type PostCompositeProofRequestRequest struct {
	PlatformProofRequestMetadata
	CompositeProofRequest
}

PostCompositeProofRequestRequest is an request payload for POST'ing a Composite Proof Request definition into the Workday Platform.

type Presentation

type Presentation struct {
	Context      []string                   `json:"@context"`
	ID           string                     `json:"id"`
	Type         []string                   `json:"type"`
	ModelVersion string                     `json:"modelVersion,omitempty"`
	Created      string                     `json:"created"`
	Credentials  []credential.RawCredential `json:"verifiableCredential"`
	Proof        []*proof.Proof             `json:"proof,omitempty"`
}

Presentation is a cryptographically signed set of Verifiable Credentials that are returned in response to a Proof Request. Each claim in a Verifiable Credential is signed using a Claim Proof. This allows for the user to selectively disclose individual claims without revealing the entire credential. The current structure does not allow for whole, signed credentials, like one would find in the W3C Verifiable Credentials Data Model.

func GeneratePresentationFromVC

func GeneratePresentationFromVC(cred *credential.RawCredential, signer proof.Signer, signatureType proof.SignatureType, presentationID string) (*Presentation, error)

GeneratePresentationFromVC generates a Presentation from a Verifiable Credential, and digitally signs it using the key material provided.

func (*Presentation) GetProof

func (p *Presentation) GetProof() *proof.Proof

These methods assume a single proof.

func (*Presentation) SetProof

func (p *Presentation) SetProof(pr *proof.Proof)

type ProofReqRespMetadata

type ProofReqRespMetadata struct {
	Type         string `json:"type,omitempty"`
	ModelVersion string `json:"modelVersion,omitempty"`
	ID           string `json:"id,omitempty"`
}

type ProofResponseSubmission

type ProofResponseSubmission struct {
	ProofRequestInstanceID string         `json:"proofRequestInstanceId"`
	Presentations          []Presentation `json:"Presentations"`
}

type SchemaReq

type SchemaReq struct {
	// deprecated
	SchemaID           string         `json:"id"`
	AuthorDID          did.DID        `json:"did,omitempty"`
	ResourceIdentifier string         `json:"resource,omitempty"`
	SchemaVersionRange string         `json:"version,omitempty"`
	Attributes         []AttributeReq `json:"attributes"`
}

SchemaReq identifies a schema and defines the collection of attributes that are being requested in the Criterion. The Verifier is discouraged from requesting attributes that are unnecessary to the context of the interaction with the Holder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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