models

package
v0.0.0-...-46352cc Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeEd25519         = "Ed25519VerificationKey2018" // Uses LD-Context for Serialization
	TypeRSA             = "RsaVerificationKey2018"
	TypeEC              = "EcdsaSecp256k1VerificationKey2019"
	TypeEC2             = "EcdsaSecp256k1RecoveryMethod2020"
	TypeJWS             = "JwsVerificationKey2020"
	TypeGPG             = "GpgVerificationKey2020"
	TypeJCS_Ed          = "JcsEd25519Signature2020" // Thats the one we should be using and supporting up until know
	TypeBBS1            = "Bls12381G1Key2020"
	TypeBBS2            = "Bls12381G2Key2020"
	TypeX25519Agreement = "X25519KeyAgreementKey2019"
	TypeECSchnorr       = "SchnorrSecp256k1VerificationKey2019" //Listed but undefined
)

Public Key types following https://w3c-ccg.github.io/ld-cryptosuite-registry/#signature-suites and https://w3c.github.io/did-spec-registries/#verification-method-types

View Source
const (
	JWT   JWTFormat = "jwt"
	JWTVC JWTFormat = "jwt_vc"
	JWTVP JWTFormat = "jwt_vp"

	LDP   LDPFormat = "ldp"
	LDPVC LDPFormat = "ldp_vc"
	LDPVP LDPFormat = "ldp_vp"

	All  Selection = "all"
	Pick Selection = "pick"

	Required  Preference = "required"
	Preferred Preference = "preferred"
)
View Source
const RequestToken = "REQUEST_TOKEN"

Request token key to save/get the request token from the context

Variables

View Source
var (
	//Common or admin
	ErrBadParamInput       = errors.New("request is not valid")
	ErrNotFound            = errors.New("your requested item is not found")
	ErrNotInitialized      = errors.New("application not initialized")
	ErrAlreadyInitialized  = errors.New("application already initialized")
	ErrNotConfigured       = errors.New("configuration available but not applied")
	ErrInternalServerError = errors.New("internal Server Error")
	ErrConflict            = errors.New("your item already exists")

	//Connect
	ErrEmptySession   = errors.New("your session is empty")
	ErrInvalidSession = errors.New("your session is invalid or cannot be queried")

	// DID
	ErrDIDNotAvailable     = errors.New("DID is not available")
	ErrCatalogNotAvailable = errors.New("catalog is not available")
	ErrMissingKey          = errors.New("verification method not present in did")
	ErrInvalidDIDMethod    = errors.New("cannot register DIDs with non GATC method")

	//Validations
	ErrNotMatch            = errors.New("presentation response does not match")
	ErrRepeatedClaim       = errors.New("required claim is found repeated")
	ErrInvalidFormat       = errors.New("document is not valid json")
	ErrUnwantedClaim       = errors.New("found unrequested claim")
	ErrMissingClaim        = errors.New("required claim is missing")
	ErrMissingConstraint   = errors.New("required constraint couldn't be satisfied")
	ErrMissingRequirement  = errors.New("submission requirement couldn't be satisfied")
	ErrMissingSecondFactor = errors.New("required second factor is missing")
	ErrMissingSFProof      = errors.New("second factor proof is missing")
	ErrSFValidation        = errors.New("second factor could not be validated")
	ErrInvalidContext      = errors.New("document linked data context couldn't be validated")
	ErrMissingVerifiable   = errors.New("missing object to verify")
	ErrSessionRequested    = errors.New("your session is already in use")
	ErrConsentValidation   = errors.New("claim consent validation fail")
	ErrCredentialsNotMatch = errors.New("credentials requested are not avaliable in tenant")
	ErrRenewDisallowed     = errors.New("renew service is not activated")

	//Status
	ErrStatusNotValid = errors.New("credential status not valid")
)

Functions

func Contains

func Contains(field string, required []string) bool

func GetFormat

func GetFormat(field interface{}) string

func JSONBytesEqual

func JSONBytesEqual(a, b []byte) (bool, error)

JSONBytesEqual compares the JSON in two byte slices for deep equality, ignoring whitespace and other non-semantically meaningful formatting differences.

func Type

func Type(field interface{}) string

func Validate

func Validate(t interface{}) error

Duplicated function to avoid import cycles

Types

type Accreditations

type Accreditations struct {
	Accreditor       string              `json:"accreditor,omitempty"`
	CreatedAt        *TimeWithFormat     `json:"createdAt,omitempty"`
	CredentialSchema string              `json:"credentialSchema,omitempty"`
	Evidence         *CredentialEvidence `json:"evidence,omitempty"`
	ExpirationDate   *TimeWithFormat     `json:"expirationDate,omitempty"`
	LevelOfTrust     int                 `json:"levelOfTrust,omitempty"`
	Proof            *Proof              `json:"proof,omitempty"`
	ValidFrom        *TimeWithFormat     `json:"validFrom,omitempty"`
}

type AuthNFactorCredential

type AuthNFactorCredential int
const (
	Silent AuthNFactorCredential = iota + 1
	Biometric
	Email
	SMS
	FaceSDK
	RemoteFaceID
)

func ToAuthNFactorCredential

func ToAuthNFactorCredential(code string) AuthNFactorCredential

func (AuthNFactorCredential) MarshalJSON

func (s AuthNFactorCredential) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (AuthNFactorCredential) String

func (d AuthNFactorCredential) String() string

func (*AuthNFactorCredential) UnmarshalJSON

func (s *AuthNFactorCredential) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type Background

type Background struct {
	Color string `json:"color,omitempty"`
	URI   string `json:"uri,omitempty"`
}

type Claim

type Claim struct {
	CurrentStatus string `json:"currentStatus"`
	Id            string `json:"id"`
	StatusReason  string `json:"statusReason,omitempty"`
}

type Constraints

type Constraints struct {
	LimitDisclosure bool        `json:"limit_disclosure,omitempty"`
	Fields          []Field     `json:"fields,omitempty"`
	SubjectIsIssuer *Preference `json:"subject_is_issuer,omitempty"`
	SubjectIsHolder *Preference `json:"subject_is_holder,omitempty"`
}

type CredentialDerivationRequest

type CredentialDerivationRequest struct {
	VerifiableCredential *VerifiableCredential `json:"verifiableCredential" description:"Original credential to be derived" `
	Frame                interface{}           `json:"frame" description:"JSON-LD frame used for selective disclosure."`
	Options              *DerivationOptions    `json:"options" description:"Configuration options to include in the derived proof"`
}

type CredentialEvidence

type CredentialEvidence struct {
	EvidenceDocs     []string `json:"evidenceDocuments,omitempty"`
	DocumentPresence string   `json:"documentPresence,omitempty"`
	Id               string   `json:"id,omitempty"`
	SubjectPresence  string   `json:"subjectPresence,omitempty"`
	Type             []string `json:"type,omitempty"`
}

type CredentialFormat

type CredentialFormat string

type CredentialIssueRequest

type CredentialIssueRequest struct {
	VerifiableCredential *VerifiableCredential `json:"verifiableCredential" description:"Original credential to be Issued" `
	Options              *IssueOptions         `json:"options" description:"Configuration options to include in the issuance proof"`
}

type CredentialRequest

type CredentialRequest struct {
	Mandatory  bool   `json:"mandatory" example:"true" description:"Mark if this credential must be present on the Presentation Response."`
	Purpose    string `` /* 126-byte string literal not displayed */
	TrustLevel int    `json:"trustLevel" example:"1" description:"Minimal level of trust required by this credential"`
	Type       string `` /* 134-byte string literal not displayed */
}

type CredentialSchema

type CredentialSchema = CredentialStatus

type CredentialStatus

type CredentialStatus struct {
	Id   string `` /* 136-byte string literal not displayed */
	Type string `json:"type,omitempty" example:"CredentialStatusList2017" description:"Credential Status Protocol definition"`
}

type CredentialStatusUpdateRequest

type CredentialStatusUpdateRequest struct {
	CredentialID     *string           `json:"credentialId" description:"Credential unique ID" example:"cred:gatc:exampleABC123" `
	CredentialStatus *CredentialStatus `json:"credentialStatus" description:"Configuration of the credential status RL"`
}

type CredentialVerificationRequest

type CredentialVerificationRequest struct {
	VerifiableCredential *VerifiableCredential `json:"verifiableCredential" description:"Original credential to be verified" `
	Options              *Proof                `json:"options" description:"Configuration options to verify the proof"`
}

type DIDDocument

type DIDDocument struct {
	Context            *SSIContext          `json:"@context,omitempty" description:"Context for JSON-LD"`
	Assertion          []VerificationMethod `` /* 219-byte string literal not displayed */
	Authentication     []VerificationMethod `` /* 219-byte string literal not displayed */
	Delegation         []VerificationMethod `` /* 279-byte string literal not displayed */
	EbsiToken          string               `` /* 146-byte string literal not displayed */
	Id                 string               `json:"id,omitempty" example:"did:example:xxxxxxxxxxxxx" description:"DID unique Identifier for resolution"`
	Invocation         []VerificationMethod `` /* 270-byte string literal not displayed */
	KeyAgreement       []VerificationMethod `` /* 211-byte string literal not displayed */
	Ledger             string               `json:"ledger,omitempty" example:"ETH" description:"DLT storing the DID Document"`
	Proof              *SSIProof            `json:"proof,omitempty" description:"Proof validating DID Document and identifying the source and control of the document."`
	PublicKey          []*PublicKey         `json:"publicKey,omitempty" description:"Description of the public keys associated to this DID - Deprecated"`
	Service            *SSIService          `json:"service,omitempty" swaggerignore:"true"`
	VerificationMethod []*PublicKey         `` /* 126-byte string literal not displayed */
}

DIDDocument represent the a client which is using Gataca Ledger is not a standard variable. We need to know where store the new DID when user create. See @https://www.w3.org/TR/did-core/#verification-methods See @https://w3c.github.io/did-spec-registries TODO: Switch PublicKey to Verification Method because of deprecation

func (*DIDDocument) GetContext

func (d *DIDDocument) GetContext() *SSIContext

func (*DIDDocument) GetKeyFromId

func (d *DIDDocument) GetKeyFromId(id string) *PublicKey

func (*DIDDocument) GetProofChain

func (d *DIDDocument) GetProofChain() *[]Proof

func (*DIDDocument) GetProofs

func (d *DIDDocument) GetProofs() *SSIProof

func (*DIDDocument) GetVerificationMethods

func (d *DIDDocument) GetVerificationMethods() []*PublicKey

For retrocompatibility with old dids

func (*DIDDocument) SetContexts

func (d *DIDDocument) SetContexts(context *SSIContext)

func (*DIDDocument) SetProofChain

func (d *DIDDocument) SetProofChain(proof *[]Proof)

func (*DIDDocument) SetProofs

func (d *DIDDocument) SetProofs(proof *SSIProof)

type DIDDocumentMetadata

type DIDDocumentMetadata struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
}

type DIFPresentationDefinition

type DIFPresentationDefinition struct {
	Name                   string                  `json:"name,omitempty"`
	ID                     string                  `json:"id" validate:"required"`
	Purpose                string                  `json:"purpose,omitempty"`
	Locale                 string                  `json:"locale,omitempty"`
	Format                 *Format                 `json:"format,omitempty"`
	SubmissionRequirements []SubmissionRequirement `json:"submission_requirements,omitempty"`
	InputDescriptors       []InputDescriptor       `json:"input_descriptors" validate:"required"`
}

type DataAgreement

type DataAgreement struct {
	Context              *SSIContext     `json:"@context,omitempty"`
	DataHolder           string          `json:"data_holder,omitempty"`
	DataReceiver         DataReceiver    `json:"data_receiver,omitempty"`
	DataSubject          string          `json:"data_subject,omitempty"`
	Dpia                 *Dpia           `json:"dpia,omitempty"`
	Event                []Event         `json:"event,omitempty"`
	ID                   string          `json:"id"`
	PersonalData         []PersonalDatum `json:"personal_data"`
	Purposes             []Purpose       `json:"purposes"`
	TemplateID           string          `json:"template_id,omitempty"`
	TemplateVersion      string          `json:"template_version,omitempty"`
	TerminationTimestamp int64           `json:"termination_timestamp,omitempty"`
	Version              string          `json:"version,omitempty"`
}

func (*DataAgreement) GetContext

func (da *DataAgreement) GetContext() *SSIContext

func (*DataAgreement) GetProofChain

func (da *DataAgreement) GetProofChain() *[]Proof

func (*DataAgreement) GetProofs

func (da *DataAgreement) GetProofs() *SSIProof

func (*DataAgreement) SetContexts

func (da *DataAgreement) SetContexts(context *SSIContext)

func (*DataAgreement) SetProofChain

func (da *DataAgreement) SetProofChain(proof *[]Proof)

func (*DataAgreement) SetProofs

func (da *DataAgreement) SetProofs(proof *SSIProof)

type DataAgreementRef

type DataAgreementRef struct {
	Ref           string
	DataAgreement *DataAgreement
}

func (DataAgreementRef) MarshalJSON

func (dar DataAgreementRef) MarshalJSON() ([]byte, error)

func (*DataAgreementRef) UnmarshalJSON

func (dar *DataAgreementRef) UnmarshalJSON(jsonData []byte) error

type DataPolicy

type DataPolicy struct {
	DataRetentionPeriod   int      `json:"data_retention_period,omitempty"`
	GeographicRestriction string   `json:"geographic_restriction,omitempty"`
	IndustryScope         string   `json:"industry_scope,omitempty"`
	Jurisdictions         []string `json:"jurisdictions,omitempty"`
	PolicyURL             string   `json:"policy_URL,omitempty"`
	StorageLocation       string   `json:"storage_location,omitempty"`
}

type DataReceiver

type DataReceiver struct {
	ID              string `json:"id,omitempty"`
	ConsentDuration int64  `json:"consent_duration,omitempty"`
	FormOfConsent   string `json:"form_of_consent,omitempty"`
	Name            string `json:"name,omitempty"`
	Service         string `json:"service,omitempty"`
	URL             string `json:"url,omitempty"`
}

type DerivationOptions

type DerivationOptions struct {
	Nonce string `json:"nonce" description:"Nonce to be included in the proof"`
}

type Descriptor

type Descriptor struct {
	ID     string           `json:"id" validate:"required"`
	Path   string           `json:"path" validate:"required"`
	Format CredentialFormat `json:"format" validate:"required"`
}

type Dpia

type Dpia struct {
	DpiaDate       string `json:"dpia_date,omitempty"`
	DpiaSummaryURL string `json:"dpia_summary_url,omitempty"`
}

type EidasCertificate

type EidasCertificate struct {
	IssuerNumber string `json:"eidasCertificateIssuerNumber,omitempty"`
	Pem          string `json:"eidasCertificatePem,omitempty"`
	SerialNumber string `json:"eidasCertificateSerialNumber,omitempty"`
}

type Event

type Event struct {
	PrincipleDid string    `json:"principle_did,omitempty"`
	Proof        *SSIProof `json:"proof,omitempty"`
	State        string    `json:"state,omitempty"`
	Version      string    `json:"version,omitempty"`
	TimeStamp    int64     `json:"timestamp,omitempty"`
}

type Evidence

type Evidence struct {
	DocumentPresence string            `json:"documentPresence,omitempty" example:"Physical"`
	EvidenceDocument *EvidenceDocument `json:"evidenceDocument,omitempty"`
	Id               string            `json:"id,omitempty" example:"https://base-uri/evidence/f2ae...5678"`
	SubjectPresence  string            `json:"subjectPresence,omitempty" example:"Physical"`
	Type             []string          `json:"type,omitempty" example:"DocumentVerification,PassportVerification"`
	Verifier         string            `json:"verifier,omitempty" example:"did:ebsi:xxxxxxx"`
}

type EvidenceDocument

type EvidenceDocument struct {
	DocumentCode           string          `json:"documentCode,omitempty" example:"P"`
	DocumentExpirationDate *TimeWithFormat `json:"documentExpirationDate,omitempty"` //Check if its RFC3339
	DocumentIssuingState   string          `json:"documentIssuingState,omitempty" example:"NLD"`
	DocumentNumber         string          `json:"documentNumber,omitempty" example:"SPECI2014"`
	Type                   string          `json:"type,omitempty" example:"Passport"`
}

type ExchangeRequest

type ExchangeRequest interface {
	IsRequest() bool
	ToPresentationDefinition() *PresentationDefinition
}

type ExchangeResponse

type ExchangeResponse interface {
	IsResponse() bool
	ToPresentation() *VerifiablePresentation
}

type Field

type Field struct {
	Path      []string    `json:"path,omitempty" validate:"required"`
	Purpose   string      `json:"purpose,omitempty"`
	Filter    *Filter     `json:"filter,omitempty"`
	Predicate *Preference `json:"predicate,omitempty"`
}

func NewConstraintsField

func NewConstraintsField(path []string) *Field

func (*Field) SetFilter

func (f *Field) SetFilter(filter Filter) error

func (*Field) SetPurpose

func (f *Field) SetPurpose(purpose string)

type Filter

type Filter struct {
	Type             string            `json:"type" validate:"required"`
	Format           string            `json:"format,omitempty"`
	Pattern          string            `json:"pattern,omitempty"`
	Minimum          StringOrInteger   `json:"minimum,omitempty"`
	Maximum          StringOrInteger   `json:"maximum,omitempty"`
	MinLength        int               `json:"minLength,omitempty"`
	MaxLength        int               `json:"maxLength,omitempty"`
	ExclusiveMinimum StringOrInteger   `json:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum StringOrInteger   `json:"exclusiveMaximum,omitempty"`
	Const            StringOrInteger   `json:"const,omitempty"`
	Enum             []StringOrInteger `json:"enum,omitempty"`
	Not              *Filter           `json:"not,omitempty"`
}

type Format

type Format struct {
	JWT   *JWTType `json:"jwt,omitempty"`
	JWTVC *JWTType `json:"jwt_vc,omitempty"`
	JWTVP *JWTType `json:"jwt_vp,omitempty"`

	LDP   *LDPType `json:"ldp,omitempty"`
	LDPVC *LDPType `json:"ldp_vc,omitempty"`
	LDPVP *LDPType `json:"ldp_vp,omitempty"`
}

type FromOption

type FromOption struct {
	From       string                  `json:"from,omitempty"`
	FromNested []SubmissionRequirement `json:"from_nested,omitempty"`
}

type InputDescriptor

type InputDescriptor struct {
	ID          string       `json:"id,omitempty" validate:"required"`
	Name        string       `json:"name,omitempty"`
	Purpose     string       `json:"purpose,omitempty"`
	Metadata    string       `json:"metadata,omitempty"`
	Group       []string     `json:"group,omitempty"`
	Schema      []Schema     `json:"schema,omitempty" validate:"required,min=1"`
	Constraints *Constraints `json:"constraints,omitempty"`
}

func NewInputDescriptor

func NewInputDescriptor(id, name, purpose, metadata string) *InputDescriptor

func (*InputDescriptor) AddSchema

func (i *InputDescriptor) AddSchema(s Schema) error

func (*InputDescriptor) SetConstraints

func (i *InputDescriptor) SetConstraints(fields ...Field) error

func (*InputDescriptor) SetConstraintsLimitDisclosure

func (i *InputDescriptor) SetConstraintsLimitDisclosure(limitDisclosure bool)

func (*InputDescriptor) SetSubjectIsHolder

func (i *InputDescriptor) SetSubjectIsHolder(preference Preference) error

func (*InputDescriptor) SetSubjectIsIssuer

func (i *InputDescriptor) SetSubjectIsIssuer(preference Preference) error

type IssueOptions

type IssueOptions struct {
	Proof
	CredentialStatus *CredentialStatus `json:"credentialStatus" description:"Configuration of the credential status RL"`
}

type JSONObject

type JSONObject interface{}

type JSONSchema

type JSONSchema interface {
	GetSchemaRef() string
	GetSchema() string
	IsRef() bool
}

type JSONSchemaMap

type JSONSchemaMap map[string]interface{}

go representation of json schema document

func (JSONSchemaMap) AllowsAdditionalProperties

func (j JSONSchemaMap) AllowsAdditionalProperties() bool

func (JSONSchemaMap) Description

func (j JSONSchemaMap) Description() string

Assumes the json schema has a description field

func (JSONSchemaMap) Properties

func (j JSONSchemaMap) Properties() Properties

Assumes the json schema has a properties field

func (JSONSchemaMap) RequiredFields

func (j JSONSchemaMap) RequiredFields() []string

func (JSONSchemaMap) ToJSON

func (j JSONSchemaMap) ToJSON() string

type JWK

type JWK struct {
	Alg     string `json:"alg,omitempty" example:"jwa values: https://www.rfc-editor.org/rfc/rfc7518.html#page-6"`
	Curve   string `json:"crv,omitempty"`
	D       string `json:"d,omitempty" description:"value of d (ECC private key, RSA private key)"`
	DP      string `json:"dp,omitempty" description:"value of first factor crt exponent (RSA private)"`
	DQ      string `json:"dq,omitempty" description:"value of second factor crt exponent (RSA private)"`
	E       string `json:"e,omitempty" description:"value of exponent (RSA public key)"`
	K       string `json:"k,omitempty" description:"value of the symmetric key (Symmetric, OCT keys)"`
	KeyId   string `json:"kid,omitempty"`
	KeyType string `json:"kty,omitempty"`
	Q       string `json:"q,omitempty" description:"value of second prime number (RSA private key)"`
	QI      string `json:"qi,omitempty" description:"value of first CRT coefficient (RSA private key)"`
	N       string `json:"n,omitempty" description:"value of moduluss (RSA public key)"`
	P       string `json:"p,omitempty" description:"value of first prime number (RSA Private key)"`
	Use     string `json:"use,omitempty" example:"sig,enc"`
	X       string `json:"x,omitempty" description:"value of x coordinate (ECC, OKP public key)"`
	Y       string `json:"y,omitempty" description:"value of y coordinate (ECC public key)"`
}

type JWTFormat

type JWTFormat CredentialFormat

type JWTType

type JWTType struct {
	Alg []string `json:"alg,omitempty" validate:"required"`
}

type LDPFormat

type LDPFormat CredentialFormat

type LDPType

type LDPType struct {
	ProofType []string `json:"proof_type,omitempty" validate:"required"`
}

type LdContext

type LdContext interface {
	GetContext() *SSIContext
	SetContexts(context *SSIContext)
}

type LdVerifiable

type LdVerifiable interface {
	LdContext
	Verifiable
}

type MechanismId

type MechanismId int
const (
	AuthNFactor MechanismId = iota + 1
	AppAuth
	Credential
)

func (MechanismId) MarshalJSON

func (s MechanismId) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (MechanismId) String

func (d MechanismId) String() string

func (*MechanismId) UnmarshalJSON

func (s *MechanismId) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type OrganizationInfo

type OrganizationInfo struct {
	AreaGroup               string            `json:"areaGroup,omitempty"`
	EORI                    string            `json:"EORI,omitempty"`
	DiscoveryURL            string            `json:"discoveryURL,omitempty"`
	DomainName              string            `json:"domainName,omitempty"`
	IdentifierBag           string            `json:"identifierBag,omitempty"`
	LegalAddress            string            `json:"legalAddress,omitempty"`
	LegalName               string            `json:"legalName,omitempty"`
	LegalPersonalIdentifier string            `json:"legalPersonalIdentifier,omitempty"`
	LEI                     string            `json:"LEI,omitempty"`
	PrefDisplay             *PreferredDisplay `json:"preferredDisplay,omitempty"`
	SEED                    string            `json:"SEED,omitempty"`
	SIC                     string            `json:"SIC,omitempty"`
	TaxReference            string            `json:"taxReference,omitempty"`
	VATRegistration         string            `json:"VATRegistration,omitempty"`
}

type PExchange

type PExchange struct {
	Id                     string
	PresentationSubmission *VerifiablePresentation
	Validations            *VerificationResult
	PresentationDefinition *PresentationDefinition
	RequestedAt            *time.Time
	CreatedAt              *time.Time
	UpdatedAt              *time.Time
	ExpiredAt              *time.Time
	DeletedAt              *pq.NullTime
}

func (*PExchange) Valid

func (pe *PExchange) Valid() bool

type PersonalDatum

type PersonalDatum struct {
	AttributeID        string   `json:"attribute_id,omitempty"`
	AttributeName      string   `json:"attribute_name,omitempty"`
	AttributeSensitive bool     `json:"attribute_sensitive,omitempty"`
	Purposes           []string `json:"purposes,omitempty"`
}

type Preference

type Preference string

type PreferredDisplay

type PreferredDisplay struct {
	Background    *Background `json:"background,omitempty"`
	PreferredName string      `json:"preferredName,omitempty"`
	Style         *Style      `json:"style,omitempty"`
}

type PresentationDefinition

type PresentationDefinition struct {
	DataAgreement *DataAgreementRef `json:"dataAgreement,omitempty"`
	DIFPresentationDefinition
	Proof *SSIProof `json:"proof,omitempty"`
}

func (*PresentationDefinition) GetProofChain

func (p *PresentationDefinition) GetProofChain() *[]Proof

func (*PresentationDefinition) GetProofs

func (p *PresentationDefinition) GetProofs() *SSIProof

func (*PresentationDefinition) IsRequest

func (p *PresentationDefinition) IsRequest() bool

func (*PresentationDefinition) SetProofChain

func (p *PresentationDefinition) SetProofChain(proof *[]Proof)

func (*PresentationDefinition) SetProofs

func (p *PresentationDefinition) SetProofs(proof *SSIProof)

func (*PresentationDefinition) ToPresentationDefinition

func (p *PresentationDefinition) ToPresentationDefinition() *PresentationDefinition

type PresentationDefinitionBuilder

type PresentationDefinitionBuilder struct {
	Definition PresentationDefinition
}

func NewPresentationDefinitionBuilder

func NewPresentationDefinitionBuilder() *PresentationDefinitionBuilder

func (*PresentationDefinitionBuilder) AddInputDescriptor

func (p *PresentationDefinitionBuilder) AddInputDescriptor(i InputDescriptor) error

func (*PresentationDefinitionBuilder) AddSubmissionRequirements

func (p *PresentationDefinitionBuilder) AddSubmissionRequirements(srs ...SubmissionRequirement) error

func (*PresentationDefinitionBuilder) Build

func (*PresentationDefinitionBuilder) SetID

func (*PresentationDefinitionBuilder) SetJWTFormat

func (p *PresentationDefinitionBuilder) SetJWTFormat(format JWTFormat, algs []string) error

func (*PresentationDefinitionBuilder) SetLDPFormat

func (p *PresentationDefinitionBuilder) SetLDPFormat(format LDPFormat, proofTypes []string) error

func (*PresentationDefinitionBuilder) SetLocale

func (p *PresentationDefinitionBuilder) SetLocale(locale string)

func (*PresentationDefinitionBuilder) SetName

func (p *PresentationDefinitionBuilder) SetName(name string)

func (*PresentationDefinitionBuilder) SetPurpose

func (p *PresentationDefinitionBuilder) SetPurpose(purpose string)

type PresentationDefinitionHolder

type PresentationDefinitionHolder struct {
	PresentationDefinition `json:"presentation_definition" validate:"required"`
}

type PresentationProveRequest

type PresentationProveRequest struct {
	VPresentation *VerifiablePresentation `json:"presentation" description:"Presentation to be proved" `
	Options       *Proof                  `json:"options" description:"Configuration options to include in the proof"`
}

type PresentationSubmission

type PresentationSubmission struct {
	ID            string       `json:"id" validate:"required"`
	DefinitionID  string       `json:"definition_id" validate:"required"`
	Locale        string       `json:"locale,omitempty"`
	DescriptorMap []Descriptor `json:"descriptor_map" validate:"required"`
}

type PresentationSubmissionBuilder

type PresentationSubmissionBuilder struct {
	Submission PresentationSubmission
}

func NewPresentationSubmissionBuilder

func NewPresentationSubmissionBuilder(definitionID string) *PresentationSubmissionBuilder

func (*PresentationSubmissionBuilder) AddDescriptor

func (p *PresentationSubmissionBuilder) AddDescriptor(d Descriptor) error

func (*PresentationSubmissionBuilder) Build

func (*PresentationSubmissionBuilder) SetDefinitionID

func (p *PresentationSubmissionBuilder) SetDefinitionID(definitionID string)

func (*PresentationSubmissionBuilder) SetID

func (*PresentationSubmissionBuilder) SetLocale

func (p *PresentationSubmissionBuilder) SetLocale(locale string)

type PresentationSubmissionHolder

type PresentationSubmissionHolder struct {
	PresentationSubmission `json:"presentation_submission" validate:"required"`
}

type PresentationVerificationRequest

type PresentationVerificationRequest struct {
	Presentation  *VerifiablePresentation `json:"presentation" description:"Proofless Presentation to be verified" `             //either only a non-verifiable presentation (proofless
	VPresentation *VerifiablePresentation `json:"verifiablePresentation" description:"Verifiable Presentation to be validated" ` //or a verifiable presentation (with options)
	Options       *Proof                  `json:"options" description:"Configuration options to verify the proof"`
}

type Proof

type Proof struct {
	CaDES              string          `` /* 131-byte string literal not displayed */
	Challenge          string          `` /* 141-byte string literal not displayed */
	Context            *SSIContext     `json:"@context,omitempty" description:"Context for JSON-LD"`
	Created            *TimeWithFormat `` /* 130-byte string literal not displayed */
	Creator            string          `json:"creator,omitempty" example:"did:gatc:yyyyyyyyyyyy#keys-1" description:"URI of the key used to sign the proof."`
	Domain             string          `json:"domain,omitempty" description:""`
	Jws                string          `` /* 3448-byte string literal not displayed */
	Nonce              string          `` /* 137-byte string literal not displayed */
	ProofPurpose       string          `json:"proofPurpose,omitempty" example:"Authentication" description:"Stated usage of the proof"`
	ProofValue         string          `json:"proofValue,omitempty" example:"bQ5AimlvOv6p5wa9pVlmjWgPMr7j9rKw_yjUL6yHlQNwnKk7HL8VQzIT0Xx" description:"Proof value."`
	SignatureValue     string          `` /* 128-byte string literal not displayed */
	Type               string          `json:"type,omitempty" example:"Ed25519Signature2018" description:"Cryptographic suite used for signature"`
	VerificationMethod string          `` /* 131-byte string literal not displayed */
}

func GetProofForVerificationMethod

func GetProofForVerificationMethod(v Verifiable, vmethod string) *Proof

func (*Proof) GetContext

func (p *Proof) GetContext() *SSIContext

func (*Proof) GetCreator

func (p *Proof) GetCreator() string

func (*Proof) GetValue

func (p *Proof) GetValue() string

func (*Proof) SetContexts

func (p *Proof) SetContexts(context *SSIContext)

type Properties

type Properties map[string]interface{}

type PublicKey

type PublicKey struct {
	Context      *SSIContext `json:"@context,omitempty" description:"Context for JSON-LD"`
	Controller   string      `json:"controller,omitempty" example:"did:example:xxxxxxxxxxxxx" description:"DID key owner"`
	Id           string      `json:"id,omitempty"  example:"did:example:xxxxxxxxxxxxx#keys-1" description:"Key Identifier as a URI"`
	EthAddress   string      `json:"ethereumAddress,omitempty" example:"0x89a932207c485f85226d86f7cd486a89a24fcc12"`
	KeyB58       string      ``                              /* 129-byte string literal not displayed */
	KeyGPG       string      ``                              /* 284-byte string literal not displayed */
	KeyHex       string      `json:"publicKeyHex,omitempty"` //Unsupported on DID-Core but widely used
	KeyJwk       *JWK        `json:"publicKeyJwk,omitempty"`
	KeyPem       string      `json:"publicKeyPem,omitempty"`
	KeyMultibase string      `json:"publicKeyMultibase,omitempty"`
	Type         string      `json:"type,omitempty" example:"Ed25519VerificationKey2018" description:"Cryptographic suite definition"` //Ed25519VerificationKey2018
	Usage        string      `json:"usage,omitempty" example:"signing,recovery"`
}

PublicKeys are yet usually only Ed25519 Keys -> publicKeyBase58

func (*PublicKey) GetContext

func (p *PublicKey) GetContext() *SSIContext

func (*PublicKey) GetKey

func (p *PublicKey) GetKey() string

func (*PublicKey) SetContexts

func (p *PublicKey) SetContexts(context *SSIContext)

type Purpose

type Purpose struct {
	DataPolicy         DataPolicy `json:"data_policy,omitempty"`
	ID                 string     `json:"id,omitempty"`
	LegalBasis         string     `json:"legal_basis,omitempty"`
	MethodOfUse        string     `json:"method_of_use,omitempty"`
	PurposeCategory    string     `json:"purpose_category,omitempty"`
	PurposeDescription string     `json:"purpose_description,omitempty"`
}

type ResponseMessage

type ResponseMessage struct {
	Message string `json:"message" example:"Some description message" description:"Operation result message description"`
}

ResponseMessage represent the response error struct

type SSIContext

type SSIContext struct {
	Context  string
	Contexts []string
}

func (*SSIContext) GetContext

func (sc *SSIContext) GetContext() []string

func (SSIContext) MarshalJSON

func (sc SSIContext) MarshalJSON() ([]byte, error)

func (*SSIContext) UnmarshalJSON

func (sc *SSIContext) UnmarshalJSON(jsonData []byte) error

type SSIProof

type SSIProof struct {
	Value  *Proof
	Values *[]Proof
}

func (*SSIProof) GetCreators

func (sp *SSIProof) GetCreators() []string

func (*SSIProof) GetProof

func (sp *SSIProof) GetProof() *[]Proof

func (SSIProof) MarshalJSON

func (sp SSIProof) MarshalJSON() ([]byte, error)

MarshalJSON TODO -When not breaking code in wallet-> Marshal as single object if only one Proof

func (*SSIProof) UnmarshalJSON

func (sp *SSIProof) UnmarshalJSON(jsonData []byte) error

type SSIService

type SSIService struct {
	Service  *Service
	Services *[]Service
}

func (*SSIService) GetServices

func (ss *SSIService) GetServices() *[]Service

func (*SSIService) MarshalJSON

func (ss *SSIService) MarshalJSON() ([]byte, error)

func (*SSIService) UnmarshalJSON

func (ss *SSIService) UnmarshalJSON(jsonData []byte) error

type Schema

type Schema struct {
	URI      string `json:"uri,omitempty"`
	Required bool   `json:"required,omitempty"`
}

type SecMechanism

type SecMechanism struct {
	Accepted []string    `json:"accepted,omitempty"`
	Type     MechanismId `json:"type,omitempty"`
}

type Selection

type Selection string

type Service

type Service struct {
	Id              string `json:"id,omitempty"`
	Type            string `json:"type,omitempty"`
	ServiceEndpoint string `json:"serviceEndpoint,omitempty"`
}

Service represent the a client which is using Gataca

type ServiceEndpoint

type ServiceEndpoint struct {
	Id           string `json:"id,omitempty"`
	ServEndpoint string `json:"serviceEndpoint,omitempty"`
	Type         string `json:"type,omitempty"`
}

type StringOrInteger

type StringOrInteger interface{}

type Style

type Style struct {
	Color      string `json:"color,omitempty"`
	FontFamily string `json:"fontFamily,omitempty"`
}

type SubmissionRequirement

type SubmissionRequirement struct {
	Name    string    `json:"name,omitempty"`
	Purpose string    `json:"purpose,omitempty"`
	Rule    Selection `json:"rule" validate:"required"`
	Count   *int      `json:"count,omitempty" validate:"min=1"`
	Minimum *int      `json:"min,omitempty"` //Can be zero
	Maximum *int      `json:"max,omitempty"`

	// Either an array of SubmissionRequirement or a string value
	FromOption `validate:"required"`
}

type TenantConfig

type TenantConfig struct {
	//Tenant
	TenantId              string                  `json:"tenantid" example:"my-tenant" description:"Tenant unique identifier"`
	DID                   string                  `json:"did" example:"did:example:xxxxxxxxxxxx" description:"Verifier DID used by the tenant"`
	Domain                string                  `json:"domain" example:"https://host.domain.com" description:"Verifier domain to receive the presentation Response"`
	Credentials           []CredentialRequest     `json:"credentials" description:"Credentials and constraint to be specified on the tenant's Presentation Requests"`
	Security              []SecMechanism          `json:"security" description:"List of security mechanisms to be enforced by the Presentation Response"`
	Callback              string                  `json:"callback" description:"Endpoint from the relying party used to notify when the user makes changes on the data"`
	DataAgreementTemplate *DataAgreement          `json:"dataAgreementTemplate" description:"Template of the Data Agreement associated with this service"`
	ServicePurpose        string                  `json:"service" description:"Description of the service that is being provided with this QR"`
	AdvancedDefinition    *PresentationDefinition `json:"advancedDefinition" description:"Presentation exchange definition at an advanced level for expert admin users"`
}

type TimeWithFormat

type TimeWithFormat struct {
	time.Time `swaggertype:"string" json:"tenants" example:"2019-10-01T12:12:05.999Z" description:"Time in RFC 3339 Format"` // embedded time value
	Format    string                                                                                                         `swaggerignore:"true"` // format
}

func (TimeWithFormat) MarshalJSON

func (ct TimeWithFormat) MarshalJSON() ([]byte, error)

type TrustedIssuer

type TrustedIssuer struct {
	Context          string            `json:"@context,omitempty"`
	Accreditations   *Accreditations   `json:"accreditations,omitempty"`
	EidasCert        *EidasCertificate `json:"eidasCertificate,omitempty"`
	Dids             []string          `json:"dids,omitempty"`
	Domain           string            `json:"domain,omitempty"`
	Id               string            `json:"id,omitempty"`
	OrgInfo          *OrganizationInfo `json:"organizationInfo,omitempty"`
	Proof            *Proof            `json:"proof,omitempty"`
	ServiceEndpoints string            `json:"serviceEndpoints,omitempty"`
}

type TrustedIssuerList

type TrustedIssuerList struct {
	Proof          *Proof          `json:"proof,omitempty"`
	TrustedIssuers []TrustedIssuer `json:"trustedIssuers,omitempty"`
}

type Verifiable

type Verifiable interface {
	GetProofs() *SSIProof
	GetProofChain() *[]Proof
	SetProofs(proof *SSIProof)
	SetProofChain(proof *[]Proof)
}

type VerifiableCredential

type VerifiableCredential struct {
	Context          *SSIContext       `json:"@context,omitempty" description:"Context for JSON-LD"`
	CredentialSchema *CredentialSchema `` //Reusing the CredentialStatusType coz its the same struct here
	/* 127-byte string literal not displayed */
	CredentialStatus  *CredentialStatus       `` /* 135-byte string literal not displayed */
	CredentialSubject *map[string]interface{} `` //swagger ignore because of unexpected problems with current library
	/* 210-byte string literal not displayed */
	Evidence       *Evidence       `json:"evidence,omitempty" swaggertype:"object,string" description:"Definition of the evidence. Required by eIDas"`
	ExpirationDate *TimeWithFormat `` /* 143-byte string literal not displayed */
	Id             string          `json:"id" example:"cred:example:zzzzzzzzzzzz" description:"Unique identifier of the Verifiable Credential"`
	Iss            string          `json:"iss,omitempty" description:"jwt fields needed for VA"`
	IssuanceDate   *TimeWithFormat `` /* 140-byte string literal not displayed */
	Issuer         string          `json:"issuer,omitempty" example:"did:example:yyyyyyyyyyyyyyyy" description:"Issuer of the credential"`
	Proof          *SSIProof       `json:"proof,omitempty"  description:"Proofs to verify the presentation"`
	Type           []string        `` /* 143-byte string literal not displayed */
	ValidFrom      *TimeWithFormat `` /* 142-byte string literal not displayed */
}

func (*VerifiableCredential) GetContext

func (v *VerifiableCredential) GetContext() *SSIContext

func (*VerifiableCredential) GetProofChain

func (v *VerifiableCredential) GetProofChain() *[]Proof

func (*VerifiableCredential) GetProofs

func (v *VerifiableCredential) GetProofs() *SSIProof

func (*VerifiableCredential) GetSchema

func (v *VerifiableCredential) GetSchema() string

func (*VerifiableCredential) GetSchemaRef

func (v *VerifiableCredential) GetSchemaRef() string

func (*VerifiableCredential) IsRef

func (v *VerifiableCredential) IsRef() bool

func (*VerifiableCredential) SetContexts

func (v *VerifiableCredential) SetContexts(context *SSIContext)

func (*VerifiableCredential) SetProofChain

func (v *VerifiableCredential) SetProofChain(proof *[]Proof)

func (*VerifiableCredential) SetProofs

func (v *VerifiableCredential) SetProofs(proof *SSIProof)

type VerifiableCredentialStatus

type VerifiableCredentialStatus struct {
	Claim   *Claim     `json:"claim"`
	Issued  *time.Time `json:"issued,omitempty"`
	Issuer  string     `json:"issuer,omitempty"`
	Proof   string     `json:"proof,omitempty"`
	Updated *time.Time `json:"updated,omitempty"`
}

type VerifiablePresentation

type VerifiablePresentation struct {
	Context                *SSIContext             `json:"@context,omitempty" description:"Context for JSON-LD"`
	DataAgreementId        string                  `` /* 142-byte string literal not displayed */
	Holder                 *string                 `json:"holder,omitempty" example:"did:gatc:example1234567" description:"DID of the Holder of the credentials"`
	PresentationSubmission *PresentationSubmission `json:"presentation_submission,omitempty" description:"Presentation submission according to DIF PE"`
	Proof                  *SSIProof               `json:"proof,omitempty" description:"Proofs to verify the presentation"`
	Type                   []string                `json:"type,omitempty" example:"VerifiablePresentation" description:"Definition of the format of the presentation"`
	VerifiableCredential   []VerifiableCredential  `json:"verifiableCredential,omitempty" description:"List of Verifiable Credentials included in the presentation"`
}

func (*VerifiablePresentation) GetContext

func (v *VerifiablePresentation) GetContext() *SSIContext

func (*VerifiablePresentation) GetProofChain

func (v *VerifiablePresentation) GetProofChain() *[]Proof

func (*VerifiablePresentation) GetProofs

func (v *VerifiablePresentation) GetProofs() *SSIProof

func (*VerifiablePresentation) IsResponse

func (v *VerifiablePresentation) IsResponse() bool

func (*VerifiablePresentation) SetContexts

func (v *VerifiablePresentation) SetContexts(context *SSIContext)

func (*VerifiablePresentation) SetProofChain

func (v *VerifiablePresentation) SetProofChain(proof *[]Proof)

func (*VerifiablePresentation) SetProofs

func (v *VerifiablePresentation) SetProofs(proof *SSIProof)

func (*VerifiablePresentation) ToPresentation

func (v *VerifiablePresentation) ToPresentation() *VerifiablePresentation

type VerifiableStatus

type VerifiableStatus struct {
	Description          string                       `json:"description,omitempty"`
	Id                   string                       `json:"id"`
	Proof                string                       `json:"issued,omitempty"`
	VerifiableCredential []VerifiableCredentialStatus `json:"verifiableCredential"`
}

type VerificationMethod

type VerificationMethod struct {
	Reference string
	Method    *PublicKey
}

func (*VerificationMethod) GetId

func (vm *VerificationMethod) GetId() string

func (*VerificationMethod) GetKeys

func (vm *VerificationMethod) GetKeys(parentKeys []*PublicKey) *PublicKey

func (*VerificationMethod) MarshalJSON

func (vm *VerificationMethod) MarshalJSON() ([]byte, error)

func (*VerificationMethod) UnmarshalJSON

func (vm *VerificationMethod) UnmarshalJSON(jsonData []byte) error

type VerificationResult

type VerificationResult struct {
	Checks   []string `json:"checks" description:"Security checks performed" example:"['proof']"`
	Warnings []string `json:"warnings" description:"Warning messages to include about the validation" example:"['Context not verified']"`
	Errors   []string `json:"errors" description:"Resulting errors on the validation. Should be empty if the validation is successful." example:"[]"`
}

func (*VerificationResult) Valid

func (v *VerificationResult) Valid() bool

Jump to

Keyboard shortcuts

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