manifest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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]any) (map[string]string, 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"`
	Applicant   string                `json:"applicant" 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) SetApplicantID

func (cab *CredentialApplicationBuilder) SetApplicantID(applicantID string) error

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           []any                 `json:"verifiableCredentials,omitempty"`
}

type CredentialManifest

type CredentialManifest struct {
	ID                     string                           `json:"id" validate:"required"`
	SpecVersion            string                           `json:"spec_version" validate:"required"`
	Name                   string                           `json:"name,omitempty"`
	Description            string                           `json:"description,omitempty"`
	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) SetDescription

func (cmb *CredentialManifestBuilder) SetDescription(description string) error

func (*CredentialManifestBuilder) SetIssuer

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

func (*CredentialManifestBuilder) SetName

func (cmb *CredentialManifestBuilder) SetName(name string) 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"`
	Applicant     string `json:"applicant"`
	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) SetApplicantID

func (crb *CredentialResponseBuilder) SetApplicantID(applicantID string) error

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        []any              `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