presentation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

https://identity.foundation/presentation-exchange/#input-descriptor-object

SPDX-FileCopyrightText: 2023 DTIT and TLABS. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alg

type Alg string
const (
	EDDSA Alg = "EdDSA"
	ES256 Alg = "ES256"
	PS256 Alg = "PS256"
)

type Constraints

type Constraints struct {
	LimitDisclosure Disclosure `json:"limit_disclosure,omitempty"` //The constraints object MAY contain a limit_disclosure property
	Fields          []Field    `json:"fields,omitempty"`           //The constraints object MAY contain a fields property
}

type Description

type Description struct {
	Id         string `json:"id"`
	Name       string `json:"name,omitempty"`
	Purpose    string `json:"purpose,omitempty"`
	FormatType string `json:"format"`
}

type Descriptor

type Descriptor struct {
	Id         string     `json:"id"`
	Format     string     `json:"format"`
	Path       string     `json:"path"`
	PathNested PathNested `json:"path_nested,omitempty"`
}

type Disclosure

type Disclosure string
const (
	Required  Disclosure = "required"
	Preferred Disclosure = "preferred"
)

type Field

type Field struct {
	Path    []string `json:"path"`              //Mandatory Field
	Id      string   `json:"id,omitempty"`      //Optional Field
	Purpose string   `json:"purpose,omitempty"` //Optional Field
	Filter  *Filter  `json:"filter,omitempty"`  //Optional Field
	Name    string   `json:"name,omitempty"`    //Optional Field
}

type Filter

type Filter struct {
	Type    string `json:"type"`
	Pattern string `json:"pattern"`
}

type FilterResult

type FilterResult struct {
	Description `json:"description"`
	Credentials map[string]interface{} `json:"credentials"`
}

type Format

type Format struct {
	SDJWT *FormatSpecification `json:"verifiable-credential+sd-jwt,omitempty"`
	LDPVP *FormatSpecification `json:"ldp_vp,omitempty"`
	LDP   *FormatSpecification `json:"ldp,omitempty"`
	LDPVC *FormatSpecification `json:"ldp_vc,omitempty"`
	JWT   *FormatSpecification `json:"jwt,omitempty"`
	JWTVC *FormatSpecification `json:"jwt_vc,omitempty"`
	JWTVP *FormatSpecification `json:"jwt_vp,omitempty"`
}

func (*Format) CheckFormats

func (format *Format) CheckFormats() error

type FormatSpecification

type FormatSpecification struct {
	ProofType []ProofType `json:"proof_type,omitempty"`
	Alg       []Alg       `json:"alg,omitempty"`
}

type InputDescriptor

type InputDescriptor struct {
	Description
	Format      Format      `json:"format"`
	Constraints Constraints `json:"constraints"`
	Group       []string    `json:"group,omitempty"`
}

func (*InputDescriptor) ApplyFieldFilter added in v0.1.3

func (descriptor *InputDescriptor) ApplyFieldFilter(value interface{}, filter Field) bool

func (*InputDescriptor) Filter

func (descriptor *InputDescriptor) Filter(credential *types.Credential) (bool, error)

type PathNested

type PathNested struct {
	Format string `json:"format"`
	Path   string `json:"path"`
}

type PresentationDefinition

type PresentationDefinition struct {
	Description
	InputDescriptors       []InputDescriptor       `json:"input_descriptors"`
	Format                 Format                  `json:"format,omitempty"`
	SubmissionRequirements []SubmissionRequirement `json:"submission_requirements,omitempty"`
}

func (*PresentationDefinition) CheckPresentationDefinition

func (definition *PresentationDefinition) CheckPresentationDefinition() error

func (*PresentationDefinition) Filter

func (definition *PresentationDefinition) Filter(credentials map[string]interface{}) ([]FilterResult, error)

type PresentationSubmission

type PresentationSubmission struct {
	Id            string       `json:"id"`
	DefinitionId  string       `json:"definition_id"`
	DescriptorMap []Descriptor `json:"descriptor_map"`
}

func CreateSubmission

func CreateSubmission(definitionId string, selection []Description) PresentationSubmission

func (*PresentationSubmission) CheckSubmissionData

func (submission *PresentationSubmission) CheckSubmissionData() error

type ProofType

type ProofType string
const (
	JsonWebSignature2020        ProofType = "JsonWebSignature2020"
	Ed25519Signature2018        ProofType = "Ed25519Signature2018"
	EcdsaSecp256k1Signature2019 ProofType = "EcdsaSecp256k1Signature2019"
	RsaSignature2018            ProofType = "RsaSignature2018"
)

type RequestObject

type RequestObject struct {
	PresentationDefinition    PresentationDefinition `json:"presentation_definition,omitempty"`
	PresentationDefinitionUri string                 `json:"presentation_definition_uri,omitempty"`
	Nonce                     string                 `json:"nonce"`
	ResponseType              types.ResponseType     `json:"response_type"`
	State                     string                 `json:"state,omitempty"`
	RedirectUri               string                 `json:"redirect_uri"`
	ClientID                  string                 `json:"client_id"`
	ResponseUri               string                 `json:"response_uri,omitempty"`
	ResponseMode              types.ResponseMode     `json:"response_mode"`
}

type ResponseParameters

type ResponseParameters struct {
	VpToken                []byte                 `json:"vp_token"`
	PresentationSubmission PresentationSubmission `json:"presentation_submission"`
}

type Rule

type Rule string
const (
	All  Rule = "all"
	Pick Rule = "pick"
)

type StateResponse

type StateResponse struct {
	ID                 string             `json:"id,omitempty"`
	State              string             `json:"state,omitempty"`
	VerifiedAttributes VerifiedAttributes `json:"verified_attributes,omitempty"`
}

type SubmissionRequirement

type SubmissionRequirement struct {
	Rule    Rule   `json:"rule"`
	From    string `json:"from"`
	Name    string `json:"name,omitempty"`
	Purpose string `json:"purpose,omitempty"`
}

type ValidPresentation

type ValidPresentation struct {
	Valid              bool                   `json:"valid"`
	Disclosure         map[string]interface{} `json:"disclosure"`
	RequiredDisclosure []string               `json:"required_disclosure"`
}

type VerifiedAttributes

type VerifiedAttributes map[string]interface{}

Jump to

Keyboard shortcuts

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