Documentation ¶
Index ¶
- Constants
- func CheckVCMatchesCriterion(criterion Criterion, cred credential.VerifiableCredential, ...) error
- func CheckVCsMatchCriterion(criterion Criterion, credentials []credential.VerifiableCredential, ...) error
- type AttributeReq
- type CompositeProofRequest
- type CompositeProofRequestInstanceChallenge
- type CompositeProofRequestRecord
- type CompositeProofRequestRecordDataHolder
- type CompositeProofResponseSubmission
- type CriteriaHolder
- func (c *CriteriaHolder) CanFulfill(cred credential.VerifiableCredential) bool
- func (c *CriteriaHolder) GetAuthorDID() did.DID
- func (c *CriteriaHolder) GetDescription() string
- func (c *CriteriaHolder) GetFields() []AttributeReq
- func (c *CriteriaHolder) GetMaxCreds() int
- func (c *CriteriaHolder) GetMinCreds() int
- func (c *CriteriaHolder) GetResourceID() string
- func (c *CriteriaHolder) GetSchema() string
- type Criterion
- type FulfilledCriterion
- type GetCompositeProofRequestRequestResponse
- type Issuers
- type PlatformProofRequestMetadata
- type PostCompositeProofRequestRequest
- type Presentation
- type ProofReqRespMetadata
- type ProofResponseSubmission
- type SchemaReq
Constants ¶
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 ¶
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 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 (c *CompositeProofRequestInstanceChallenge) GetProof() *proof.Proof
func (*CompositeProofRequestInstanceChallenge) SetProof ¶
func (c *CompositeProofRequestInstanceChallenge) SetProof(p *proof.Proof)
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 ¶
func (c *CompositeProofResponseSubmission) GetProof() *proof.Proof
These methods assume a single proof.
func (*CompositeProofResponseSubmission) SetProof ¶
func (c *CompositeProofResponseSubmission) SetProof(pr *proof.Proof)
type CriteriaHolder ¶
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 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 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.