manifest

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 9

Documentation

Index

Constants

View Source
const (
	BuilderEmptyError string = "builder cannot be empty"
	SpecVersion       string = "https://identity.foundation/credential-manifest/spec/v1.0.0/"
)
View Source
const (
	CredentialManifestJSONProperty    = "credential_manifest"
	CredentialApplicationJSONProperty = "credential_application"
	CredentialResponseJSONProperty    = "credential_response"
)

Variables

This section is empty.

Functions

func AreValidOutputDescriptors

func AreValidOutputDescriptors(descriptors []OutputDescriptor) error

AreValidOutputDescriptors validates a set of output descriptor objects against its known JSON schema

func IsValidCredentialApplication

func IsValidCredentialApplication(application CredentialApplication) error

IsValidCredentialApplication validates a given credential application object against its known JSON schema

func IsValidCredentialApplicationForManifest

func IsValidCredentialApplicationForManifest(cm CredentialManifest, applicationAndCredsJSON map[string]interface{}) (unfulfilledInputDescriptors map[string]string, err error)

IsValidCredentialApplicationForManifest validates the rules on how a credential manifest [cm] and credential application [ca] relate to each other https://identity.foundation/credential-manifest/#credential-application applicationAndCredsJSON is the credential application and credentials as a JSON object

func IsValidCredentialManifest

func IsValidCredentialManifest(manifest CredentialManifest) error

IsValidCredentialManifest validates a given credential manifest object against its known JSON schema

func IsValidCredentialResponse

func IsValidCredentialResponse(response CredentialResponse) error

IsValidCredentialResponse validates a given credential response object against its known JSON schema

Types

type CredentialApplication

type CredentialApplication struct {
	ID          string                `json:"id" validate:"required"`
	SpecVersion string                `json:"spec_version" validate:"required"`
	ManifestID  string                `json:"manifest_id" validate:"required"`
	Format      *exchange.ClaimFormat `json:"format" validate:"required,dive"`
	// Must be present if the corresponding manifest contains a presentation_definition
	PresentationSubmission *exchange.PresentationSubmission `json:"presentation_submission,omitempty" validate:"omitempty,dive"`
}

CredentialApplication https://identity.foundation/credential-manifest/#credential-application

func (*CredentialApplication) IsEmpty

func (ca *CredentialApplication) IsEmpty() bool

func (*CredentialApplication) IsValid

func (ca *CredentialApplication) IsValid() error

type CredentialApplicationBuilder

type CredentialApplicationBuilder struct {
	*CredentialApplication
}

func NewCredentialApplicationBuilder

func NewCredentialApplicationBuilder(manifestID string) CredentialApplicationBuilder

func (*CredentialApplicationBuilder) Build

func (*CredentialApplicationBuilder) IsEmpty

func (cab *CredentialApplicationBuilder) IsEmpty() bool

func (*CredentialApplicationBuilder) SetApplicationClaimFormat

func (cab *CredentialApplicationBuilder) SetApplicationClaimFormat(format exchange.ClaimFormat) error

func (*CredentialApplicationBuilder) SetApplicationManifestID

func (cab *CredentialApplicationBuilder) SetApplicationManifestID(manifestID string) error

func (*CredentialApplicationBuilder) SetPresentationSubmission

func (cab *CredentialApplicationBuilder) SetPresentationSubmission(submission exchange.PresentationSubmission) error

type CredentialApplicationWrapper

type CredentialApplicationWrapper struct {
	CredentialApplication CredentialApplication `json:"credential_application"`
	Credentials           []interface{}         `json:"verifiableCredentials,omitempty"`
}

type CredentialManifest

type CredentialManifest struct {
	ID                     string                           `json:"id" validate:"required"`
	SpecVersion            string                           `json:"spec_version" validate:"required"`
	Issuer                 Issuer                           `json:"issuer" validate:"required,dive"`
	OutputDescriptors      []OutputDescriptor               `json:"output_descriptors" validate:"required,dive"`
	Format                 *exchange.ClaimFormat            `json:"format,omitempty" validate:"omitempty,dive"`
	PresentationDefinition *exchange.PresentationDefinition `json:"presentation_definition,omitempty" validate:"omitempty,dive"`
}

CredentialManifest https://identity.foundation/credential-manifest/#general-composition

func (*CredentialManifest) IsEmpty

func (cm *CredentialManifest) IsEmpty() bool

func (*CredentialManifest) IsValid

func (cm *CredentialManifest) IsValid() error

type CredentialManifestBuilder

type CredentialManifestBuilder struct {
	*CredentialManifest
}

func NewCredentialManifestBuilder

func NewCredentialManifestBuilder() CredentialManifestBuilder

func (*CredentialManifestBuilder) Build

func (*CredentialManifestBuilder) IsEmpty

func (cmb *CredentialManifestBuilder) IsEmpty() bool

func (*CredentialManifestBuilder) SetClaimFormat

func (cmb *CredentialManifestBuilder) SetClaimFormat(format exchange.ClaimFormat) error

func (*CredentialManifestBuilder) SetIssuer

func (cmb *CredentialManifestBuilder) SetIssuer(i Issuer) error

func (*CredentialManifestBuilder) SetOutputDescriptors

func (cmb *CredentialManifestBuilder) SetOutputDescriptors(descriptors []OutputDescriptor) error

func (*CredentialManifestBuilder) SetPresentationDefinition

func (cmb *CredentialManifestBuilder) SetPresentationDefinition(definition exchange.PresentationDefinition) error

type CredentialResponse

type CredentialResponse struct {
	ID            string `json:"id" validate:"required"`
	SpecVersion   string `json:"spec_version" validate:"required"`
	ManifestID    string `json:"manifest_id" validate:"required"`
	ApplicationID string `json:"application_id"`
	Fulfillment   *struct {
		DescriptorMap []exchange.SubmissionDescriptor `json:"descriptor_map" validate:"required"`
	} `json:"fulfillment,omitempty" validate:"omitempty,dive"`
	Denial *struct {
		Reason           string   `json:"reason" validate:"required"`
		InputDescriptors []string `json:"input_descriptors,omitempty"`
	} `json:"denial,omitempty" validate:"omitempty,dive"`
}

CredentialResponse https://identity.foundation/credential-manifest/#credential-response

func (*CredentialResponse) IsEmpty

func (cf *CredentialResponse) IsEmpty() bool

func (*CredentialResponse) IsValid

func (cf *CredentialResponse) IsValid() error

type CredentialResponseBuilder

type CredentialResponseBuilder struct {
	*CredentialResponse
}

func NewCredentialResponseBuilder

func NewCredentialResponseBuilder(manifestID string) CredentialResponseBuilder

func (*CredentialResponseBuilder) Build

func (*CredentialResponseBuilder) IsEmpty

func (crb *CredentialResponseBuilder) IsEmpty() bool

func (*CredentialResponseBuilder) SetApplicationID

func (crb *CredentialResponseBuilder) SetApplicationID(applicationID string) error

func (*CredentialResponseBuilder) SetDenial

func (crb *CredentialResponseBuilder) SetDenial(reason string, inputDescriptors ...string) error

func (*CredentialResponseBuilder) SetFulfillment

func (crb *CredentialResponseBuilder) SetFulfillment(descriptors []exchange.SubmissionDescriptor) error

func (*CredentialResponseBuilder) SetManifestID

func (crb *CredentialResponseBuilder) SetManifestID(manifestID string) error

type CredentialResponseWrapper

type CredentialResponseWrapper struct {
	CredentialResponse CredentialResponse `json:"credential_response"`
	Credentials        []interface{}      `json:"verifiableCredentials,omitempty"`
}

type Issuer

type Issuer struct {
	ID   string `json:"id" validate:"required"`
	Name string `json:"name,omitempty"`
	// an object or URI as defined by the DIF Entity Styles specification
	// https://identity.foundation/wallet-rendering/#entity-styles
	Styles *rendering.EntityStyleDescriptor `json:"styles,omitempty"`
}

type OutputDescriptor

type OutputDescriptor struct {
	// Must be unique within a manifest
	ID          string `json:"id" validate:"required"`
	Schema      string `json:"schema" validate:"required"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	// both below: an object or URI as defined by the DIF Entity Styles specification
	Display *rendering.DataDisplay           `json:"display,omitempty"`
	Styles  *rendering.EntityStyleDescriptor `json:"styles,omitempty"`
}

OutputDescriptor https://identity.foundation/credential-manifest/#output-descriptor

func (*OutputDescriptor) IsEmpty

func (od *OutputDescriptor) IsEmpty() bool

func (*OutputDescriptor) IsValid

func (od *OutputDescriptor) IsValid() error

Jump to

Keyboard shortcuts

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