Documentation ¶
Overview ¶
Package concept is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CologneTransformer(text interface{}) interface{}
- func TestVC() vc.VerifiableCredential
- type Clause
- type Concept
- type Config
- type CredentialQuery
- type Index
- type IndexPart
- type MockReader
- func (m *MockReader) Concepts() []Config
- func (m *MockReader) EXPECT() *MockReaderMockRecorder
- func (m *MockReader) FindByType(credentialType string) *Config
- func (m *MockReader) QueryFor(concept string) (Query, error)
- func (m *MockReader) Transform(concept string, VC vc.VerifiableCredential) (Concept, error)
- type MockReaderMockRecorder
- func (mr *MockReaderMockRecorder) Concepts() *gomock.Call
- func (mr *MockReaderMockRecorder) FindByType(credentialType interface{}) *gomock.Call
- func (mr *MockReaderMockRecorder) QueryFor(concept interface{}) *gomock.Call
- func (mr *MockReaderMockRecorder) Transform(concept, VC interface{}) *gomock.Call
- type MockRegistry
- func (m *MockRegistry) Add(config Config) error
- func (m *MockRegistry) Concepts() []Config
- func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
- func (m *MockRegistry) FindByType(credentialType string) *Config
- func (m *MockRegistry) QueryFor(concept string) (Query, error)
- func (m *MockRegistry) Transform(concept string, VC vc.VerifiableCredential) (Concept, error)
- type MockRegistryMockRecorder
- func (mr *MockRegistryMockRecorder) Add(config interface{}) *gomock.Call
- func (mr *MockRegistryMockRecorder) Concepts() *gomock.Call
- func (mr *MockRegistryMockRecorder) FindByType(credentialType interface{}) *gomock.Call
- func (mr *MockRegistryMockRecorder) QueryFor(concept interface{}) *gomock.Call
- func (mr *MockRegistryMockRecorder) Transform(concept, VC interface{}) *gomock.Call
- type MockWriter
- type MockWriterMockRecorder
- type Query
- type Reader
- type Registry
- type Writer
Constants ¶
const ( // AuthorizationConcept is a concept required for authorization credentials AuthorizationConcept = "authorization" // OrganizationConcept is a concept required for the auth module to work OrganizationConcept = "organization" // OrganizationName defines the concept path for an organization name OrganizationName = "organization.name" // OrganizationCity defines the concept path for an organization city OrganizationCity = "organization.city" )
const EqType = "eq"
EqType is the identifier for an equals clause
const ExampleConcept = "human"
const ExampleType = "HumanCredential"
const IDField = "id"
IDField defines the concept/VC JSON joinPath to a VC ID
const IssuerField = "issuer"
IssuerField defines the concept/VC JSON joinPath to a VC issuer
const PrefixType = "prefix"
PrefixType is the identifier for a prefix clause
const SubjectField = "subject"
SubjectField defines the concept JSONPath to a VC subject
const TestCredential = `` /* 555-byte string literal not displayed */
const TestRevocation = `` /* 229-byte string literal not displayed */
const TypeField = "type"
TypeField defines the concept/VC JSON joinPath to a VC type
Variables ¶
var ErrIncorrectType = errors.New("set value is not of correct type")
ErrIncorrectType is returned when a requested value type is different tham the set type.
var ErrNoType = errors.New("no template type found")
ErrNoType is returned when a template is loaded which doesn't have a type
var ErrNoValue = errors.New("no value for given path")
ErrNoValue is returned when a requested path doesn't have a value.
var ErrUnknownConcept = errors.New("unknown concept")
ErrUnknownConcept is returned when an unknown concept is requested
var ExampleConfig = Config{ Concept: "human", CredentialType: "HumanCredential", Indices: []Index{ { Name: "human", Parts: []IndexPart{ {Alias: &humanEyeColour, JSONPath: "credentialSubject.human.eyeColour"}, {Alias: &humanHairColour, JSONPath: "credentialSubject.human.hairColour"}, }, }, { Name: "subject", Parts: []IndexPart{{Alias: &humanSubject, JSONPath: "credentialSubject.id"}}, }, { Name: "id", Parts: []IndexPart{{JSONPath: "id"}}, }, { Name: "issuer", Parts: []IndexPart{{JSONPath: "issuer"}}, }, }, Template: &humanTemplate, }
Functions ¶
func CologneTransformer ¶
func CologneTransformer(text interface{}) interface{}
CologneTransformer is a go-leia compatible function for generating the phonetic representation of a string.
func TestVC ¶
func TestVC() vc.VerifiableCredential
Types ¶
type Clause ¶
type Clause interface { // Key returns the key to match against. Key() string // Seek returns the first matching value for this Clause or "" if not applicable. Seek() string // Match returns the string that should match each subsequent test when using a cursor or something equal. Match() string // Type returns the clause identifier type. This type is used for mapping to the underlying DB query language Type() string }
Clause abstracts different equality clauses, comparable to '=', '!=', 'between' and 'abc%' in SQL. note: it currently only supports a key/value store with a binary tree index. When other DB's need to be supported, it could be the case that we will have to add 'dialects' for queries.
type Concept ¶
type Concept map[string]interface{}
Concept is a JSON format for querying and returning results of queries. It contains the default values of a VC: id, type, issuer and subject as well as custom concept specific data.
type Config ¶
type Config struct { // Concept groups multiple credentials under a single name Concept string `yaml:"concept"` // CredentialType defines the type of the credential. 'VerifiableCredential' is omitted. CredentialType string `yaml:"credentialType"` // Indices contains a set of Index values Indices []Index `yaml:"indices"` // Public indicates if this credential may be published on the DAG Public bool `yaml:"public"` // Template is the string template for outputting a credential to a common format // Each <<JSONPath>> value is substituted with the outcome of the JSONPath query Template *string `yaml:"template"` }
Config defines the concept configuration for a VerifiableCredential
type CredentialQuery ¶
type CredentialQuery struct { Clauses []Clause // contains filtered or unexported fields }
CredentialQuery represents a query/template combination
func (*CredentialQuery) CredentialType ¶
func (tq *CredentialQuery) CredentialType() string
CredentialType returns the VC type.
type Index ¶
type Index struct { // Name identifies the index, must be unique per credential Name string `yaml:"name"` // Parts defines the individual index parts, the ordering is significant Parts []IndexPart `yaml:"parts"` }
Index for a credential
type IndexPart ¶
type IndexPart struct { // Alias defines an optional alias that can be used within a search query Alias *string `yaml:"alias"` // JSONPath defines the JSON search path JSONPath string `yaml:"path"` // Tokenizer defines an optional tokenizer. Possible values: [whitespace] Tokenizer *string `yaml:"tokenizer"` // Transformer defines an optional transformer. Possible values: [cologne, lowercase] Transformer *string `yaml:"transformer"` }
IndexPart defines the JSONPath and type of index for a partial index within a compound index
type MockReader ¶
type MockReader struct {
// contains filtered or unexported fields
}
MockReader is a mock of Reader interface.
func NewMockReader ¶
func NewMockReader(ctrl *gomock.Controller) *MockReader
NewMockReader creates a new mock instance.
func (*MockReader) EXPECT ¶
func (m *MockReader) EXPECT() *MockReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockReader) FindByType ¶
func (m *MockReader) FindByType(credentialType string) *Config
FindByType mocks base method.
func (*MockReader) QueryFor ¶
func (m *MockReader) QueryFor(concept string) (Query, error)
QueryFor mocks base method.
func (*MockReader) Transform ¶
func (m *MockReader) Transform(concept string, VC vc.VerifiableCredential) (Concept, error)
Transform mocks base method.
type MockReaderMockRecorder ¶
type MockReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockReaderMockRecorder is the mock recorder for MockReader.
func (*MockReaderMockRecorder) Concepts ¶
func (mr *MockReaderMockRecorder) Concepts() *gomock.Call
Concepts indicates an expected call of Concepts.
func (*MockReaderMockRecorder) FindByType ¶
func (mr *MockReaderMockRecorder) FindByType(credentialType interface{}) *gomock.Call
FindByType indicates an expected call of FindByType.
func (*MockReaderMockRecorder) QueryFor ¶
func (mr *MockReaderMockRecorder) QueryFor(concept interface{}) *gomock.Call
QueryFor indicates an expected call of QueryFor.
func (*MockReaderMockRecorder) Transform ¶
func (mr *MockReaderMockRecorder) Transform(concept, VC interface{}) *gomock.Call
Transform indicates an expected call of Transform.
type MockRegistry ¶
type MockRegistry struct {
// contains filtered or unexported fields
}
MockRegistry is a mock of Registry interface.
func NewMockRegistry ¶
func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry
NewMockRegistry creates a new mock instance.
func (*MockRegistry) Concepts ¶
func (m *MockRegistry) Concepts() []Config
Concepts mocks base method.
func (*MockRegistry) EXPECT ¶
func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRegistry) FindByType ¶
func (m *MockRegistry) FindByType(credentialType string) *Config
FindByType mocks base method.
func (*MockRegistry) QueryFor ¶
func (m *MockRegistry) QueryFor(concept string) (Query, error)
QueryFor mocks base method.
func (*MockRegistry) Transform ¶
func (m *MockRegistry) Transform(concept string, VC vc.VerifiableCredential) (Concept, error)
Transform mocks base method.
type MockRegistryMockRecorder ¶
type MockRegistryMockRecorder struct {
// contains filtered or unexported fields
}
MockRegistryMockRecorder is the mock recorder for MockRegistry.
func (*MockRegistryMockRecorder) Add ¶
func (mr *MockRegistryMockRecorder) Add(config interface{}) *gomock.Call
Add indicates an expected call of Add.
func (*MockRegistryMockRecorder) Concepts ¶
func (mr *MockRegistryMockRecorder) Concepts() *gomock.Call
Concepts indicates an expected call of Concepts.
func (*MockRegistryMockRecorder) FindByType ¶
func (mr *MockRegistryMockRecorder) FindByType(credentialType interface{}) *gomock.Call
FindByType indicates an expected call of FindByType.
func (*MockRegistryMockRecorder) QueryFor ¶
func (mr *MockRegistryMockRecorder) QueryFor(concept interface{}) *gomock.Call
QueryFor indicates an expected call of QueryFor.
func (*MockRegistryMockRecorder) Transform ¶
func (mr *MockRegistryMockRecorder) Transform(concept, VC interface{}) *gomock.Call
Transform indicates an expected call of Transform.
type MockWriter ¶
type MockWriter struct {
// contains filtered or unexported fields
}
MockWriter is a mock of Writer interface.
func NewMockWriter ¶
func NewMockWriter(ctrl *gomock.Controller) *MockWriter
NewMockWriter creates a new mock instance.
func (*MockWriter) EXPECT ¶
func (m *MockWriter) EXPECT() *MockWriterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockWriterMockRecorder ¶
type MockWriterMockRecorder struct {
// contains filtered or unexported fields
}
MockWriterMockRecorder is the mock recorder for MockWriter.
func (*MockWriterMockRecorder) Add ¶
func (mr *MockWriterMockRecorder) Add(config interface{}) *gomock.Call
Add indicates an expected call of Add.
type Query ¶
type Query interface { // Concept returns the concept name. Concept() string // Parts returns the different concept queries Parts() []*CredentialQuery // AddClause adds a clause to the query. AddClause(clause Clause) }
Query is an DB query abstraction. it is created from the registry in the context of a concept. It contains concept specific query arguments, that need to be resolved by the DB facade using the template registry.
type Reader ¶
type Reader interface { // Concepts returns a list of concept configs Concepts() []Config // FindByType returns the Config if the given credentialType is registered, nil otherwise FindByType(credentialType string) *Config // QueryFor creates a query for the given concept. // The query is preloaded with required fixed values like the type. // It returns ErrUnknownConcept if the concept is not found QueryFor(concept string) (Query, error) // Transform a VerifiableCredential to concept format. Transform(concept string, VC vc.VerifiableCredential) (Concept, error) }
Reader contains all read-only operations for the concept registry
type Registry ¶
Registry defines the interface for accessing loaded concepts and using the templates to generate queries and transform results.
func NewRegistry ¶
func NewRegistry() Registry
NewRegistry creates a new registry instance with no templates.