verifiableCredentials

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

View Source
const SecuritySuitesJWS2020 = "https://w3id.org/security/suites/jws-2020/v1"
View Source
const W3Credentials = "https://www.w3.org/2018/credentials/v1"

Variables

This section is empty.

Functions

func DefaultRetryPolicy

func DefaultRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)

DefaultRetryPolicy fork from https://github.com/hashicorp/go-retryablehttp/blob/v0.7.4/client.go

func GenerateHash

func GenerateHash(sd []byte) string

func VerifyCertChain

func VerifyCertChain(url string) (*x509.Certificate, error)

Types

type ComplianceCredentialSubject

type ComplianceCredentialSubject struct {
	Type                     string `json:"type"`
	ID                       string `json:"id"`
	GxIntegrity              string `json:"gx:integrity"`
	GxIntegrityNormalization string `json:"gx:integrityNormalization"`
	GxVersion                string `json:"gx:version"`
	GxType                   string `json:"gx:type"`
}

ComplianceCredentialSubject implements the shape as returned by the compliance service as compliance credentials

func NewComplianceCredentialSubjectFormMap

func NewComplianceCredentialSubjectFormMap(c map[string]interface{}) (*ComplianceCredentialSubject, error)

NewComplianceCredentialSubjectFormMap marshals a map to ComplianceCredentialSubject or returns an error

type Context

type Context struct {
	Context []string
	// contains filtered or unexported fields
}

func (*Context) MarshalJSON

func (c *Context) MarshalJSON() ([]byte, error)

func (*Context) UnmarshalJSON

func (c *Context) UnmarshalJSON(dat []byte) error

type CredentialSubject

type CredentialSubject struct {
	CredentialSubject []map[string]interface{}
	// contains filtered or unexported fields
}

func (*CredentialSubject) MarshalJSON

func (cs *CredentialSubject) MarshalJSON() ([]byte, error)

func (*CredentialSubject) UnmarshalJSON

func (cs *CredentialSubject) UnmarshalJSON(dat []byte) error

type DocumentLoader

type DocumentLoader struct {
	// contains filtered or unexported fields
}

DocumentLoader fork from ld.DefaultDocumentLoader https://github.com/piprate/json-gold/blob/master/ld/document_loader.go

func NewDocumentLoader

func NewDocumentLoader(httpClient *http.Client) *DocumentLoader

NewDocumentLoader fork from ld.DefaultDocumentLoader https://github.com/piprate/json-gold/blob/master/ld/document_loader.go

func (*DocumentLoader) LoadDocument

func (dl *DocumentLoader) LoadDocument(u string) (*ld.RemoteDocument, error)

LoadDocument returns a RemoteDocument containing the contents of the JSON resource from the given URL. fork from https://github.com/piprate/json-gold/blob/master/ld/document_loader.go

type Proof

type Proof struct {
	Type               string `json:"type"`
	Created            string `json:"created"`
	ProofPurpose       string `json:"proofPurpose"`
	VerificationMethod string `json:"verificationMethod"`
	JWS                string `json:"jws"`
}

type Proofs

type Proofs struct {
	Proofs   []*Proof
	WasSlice bool
}

func (*Proofs) MarshalJSON

func (cs *Proofs) MarshalJSON() ([]byte, error)

func (*Proofs) UnmarshalJSON

func (cs *Proofs) UnmarshalJSON(dat []byte) error

type RegistrationNumber2210Struct

type RegistrationNumber2210Struct struct {
	Context                         Context `json:"@context"`
	Type                            string  `json:"type"`
	ID                              string  `json:"id"`
	GxVatID                         string  `json:"gx:vatID,omitempty"`
	GXVATCountryCode                string  `json:"gx:vatID-countryCode,omitempty"`
	GxLeiCode                       string  `json:"gx:leiCode,omitempty"`
	GxLeiCodeCountryCode            string  `json:"gx:leiCode-countryCode,omitempty"`
	GxLeiCodeSubdivisionCountryCode string  `json:"gx:leiCode-subdivisionCountryCode,omitempty"`
	GXTaxID                         string  `json:"gx:taxID,omitempty"`
	GXEUID                          string  `json:"gx:EUID,omitempty"`
	GXEORI                          string  `json:"gx:EORI,omitempty"`
}

RegistrationNumber2210Struct implements the shape of the registry number see: https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#gx:legalRegistrationNumberShape

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore() *Store

func NewStoreFromFile

func NewStoreFromFile(path string, keyPhrase []byte) (s *Store, err error)

func (*Store) Create

func (s *Store) Create(vc *VerifiableCredential) error

func (*Store) Delete

func (s *Store) Delete(id string)

func (*Store) GetAllIndex

func (s *Store) GetAllIndex() []string

func (*Store) Read

func (s *Store) Read(id string) (*VerifiableCredential, error)

func (*Store) ToFile

func (s *Store) ToFile(path string, keyPhrase []byte) (err error)

func (*Store) Update

func (s *Store) Update(vc *VerifiableCredential) error

type TermsAndConditions2210Struct

type TermsAndConditions2210Struct struct {
	Context              Context `json:"@context"`
	Type                 string  `json:"type"`
	GxTermsAndConditions string  `json:"gx:termsAndConditions"`
	ID                   string  `json:"id"`
}

TermsAndConditions2210Struct implements the shape of the terms and conditions see: https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#gx:GaiaXTermsAndConditionsShape

type VCType

type VCType struct {
	Types []string
	// contains filtered or unexported fields
}

func (*VCType) MarshalJSON

func (t *VCType) MarshalJSON() ([]byte, error)

func (*VCType) UnmarshalJSON

func (t *VCType) UnmarshalJSON(dat []byte) error

type VerifiableCredential

type VerifiableCredential struct {
	Context           Context           `json:"@context" validate:"required"`
	Type              VCType            `json:"type" validate:"required"`
	IssuanceDate      string            `json:"issuanceDate" validate:"required"`
	ExpirationDate    string            `json:"expirationDate,omitempty"`
	CredentialSubject CredentialSubject `json:"credentialSubject,omitempty"`
	Issuer            string            `json:"issuer" validate:"required"`
	ID                string            `json:"id" validate:"required"`
	Proof             *Proofs           `json:"proof,omitempty"`
	Evidence          []struct {
		GxEvidenceURL   string `json:"gx:evidenceURL,omitempty"`
		GxExecutionDate string `json:"gx:executionDate,omitempty"`
		GxEvidenceOf    string `json:"gx:evidenceOf,omitempty"`
	} `json:"evidence,omitempty"`

	Options *ld.JsonLdOptions `json:"-"`
	// contains filtered or unexported fields
}

VerifiableCredential implements the shape of a VC as defined in https://www.w3.org/TR/vc-data-model/#basic-concepts

func NewEmptyVerifiableCredential

func NewEmptyVerifiableCredential() *VerifiableCredential

func (*VerifiableCredential) CanonizeGo

func (c *VerifiableCredential) CanonizeGo() ([]byte, error)

func (*VerifiableCredential) Hash

func (c *VerifiableCredential) Hash() (string, error)

func (*VerifiableCredential) JSC

func (c *VerifiableCredential) JSC() ([]byte, error)

func (*VerifiableCredential) String

func (c *VerifiableCredential) String() string

func (*VerifiableCredential) ToBase64

func (c *VerifiableCredential) ToBase64() (string, error)

func (*VerifiableCredential) ToJson

func (c *VerifiableCredential) ToJson() ([]byte, error)

func (*VerifiableCredential) ToMap

func (c *VerifiableCredential) ToMap() (map[string]interface{}, error)

func (*VerifiableCredential) Validate

func (c *VerifiableCredential) Validate(validate *validator.Validate) error

func (*VerifiableCredential) Verify

func (c *VerifiableCredential) Verify() error

type VerifiablePresentation

type VerifiablePresentation struct {
	Context              string                  `json:"@context" validate:"required"`
	Type                 string                  `json:"type" validate:"required"`
	VerifiableCredential []*VerifiableCredential `json:"verifiableCredential" validate:"required"`
	Proof                *Proofs                 `json:"proof,omitempty"`
}

VerifiablePresentation implements the shape of a verifiable presentation as defined in: https://www.w3.org/TR/vc-data-model/#presentations since Gaia-X has not defined a proof method yet, this is still open

func NewEmptyVerifiablePresentation

func NewEmptyVerifiablePresentation() *VerifiablePresentation

func (*VerifiablePresentation) String

func (vp *VerifiablePresentation) String() string

func (*VerifiablePresentation) ToBase64 added in v0.1.1

func (vp *VerifiablePresentation) ToBase64() (string, error)

func (*VerifiablePresentation) ToJson added in v0.1.1

func (vp *VerifiablePresentation) ToJson() ([]byte, error)

func (*VerifiablePresentation) ToMap

func (vp *VerifiablePresentation) ToMap() (map[string]interface{}, error)

ToMap returns the map[string]interface{} representation of the VP, this a deep copy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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