schema

package
v0.0.0-...-89805ac Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version1 string = "1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSchemaRequest

type CreateSchemaRequest struct {
	Author string            `json:"author" validate:"required"`
	Name   string            `json:"name" validate:"required"`
	Schema schema.JSONSchema `json:"schema" validate:"required"`
	Sign   bool              `json:"signed"`
}

func (CreateSchemaRequest) IsValid

func (csr CreateSchemaRequest) IsValid() bool

type CreateSchemaResponse

type CreateSchemaResponse struct {
	ID        string              `json:"id"`
	Schema    schema.VCJSONSchema `json:"schema"`
	SchemaJWT *keyaccess.JWT      `json:"schemaJwt,omitempty"`
}

type DeleteSchemaRequest

type DeleteSchemaRequest struct {
	ID string `json:"id" validate:"required"`
}

type GetSchemaRequest

type GetSchemaRequest struct {
	ID string `json:"id" validate:"required"`
}

type GetSchemaResponse

type GetSchemaResponse struct {
	ID        string              `json:"id"`
	Schema    schema.VCJSONSchema `json:"schema"`
	SchemaJWT *keyaccess.JWT      `json:"schemaJwt,omitempty"`
}

type GetSchemasResponse

type GetSchemasResponse struct {
	Schemas []GetSchemaResponse `json:"schemas,omitempty"`
}

type Service

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

func NewSchemaService

func NewSchemaService(config config.SchemaServiceConfig, s storage.ServiceStorage, keyStore *keystore.Service, resolver *didsdk.Resolver) (*Service, error)

func (Service) Config

func (s Service) Config() config.SchemaServiceConfig

func (Service) CreateSchema

func (s Service) CreateSchema(request CreateSchemaRequest) (*CreateSchemaResponse, error)

CreateSchema houses the main service logic for schema creation. It validates the input, and produces a schema value that conforms with the VC JSON JSONSchema specification. TODO(gabe) support data integrity proof generation on schemas, versioning, and more

func (Service) DeleteSchema

func (s Service) DeleteSchema(request DeleteSchemaRequest) error

func (Service) GetSchema

func (s Service) GetSchema(request GetSchemaRequest) (*GetSchemaResponse, error)

func (Service) GetSchemas

func (s Service) GetSchemas() (*GetSchemasResponse, error)

func (Service) Resolve

func (s Service) Resolve(id string) (*schema.VCJSONSchema, error)

func (Service) Status

func (s Service) Status() framework.Status

func (Service) Type

func (s Service) Type() framework.Type

func (Service) VerifySchema

func (s Service) VerifySchema(request VerifySchemaRequest) (*VerifySchemaResponse, error)

VerifySchema verifies a schema's signature and makes sure the schema is compliant with the specification

type Storage

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

func NewSchemaStorage

func NewSchemaStorage(db storage.ServiceStorage) (*Storage, error)

func (*Storage) DeleteSchema

func (ss *Storage) DeleteSchema(id string) error

func (*Storage) GetSchema

func (ss *Storage) GetSchema(id string) (*StoredSchema, error)

func (*Storage) GetSchemas

func (ss *Storage) GetSchemas() ([]StoredSchema, error)

GetSchemas attempts to get all stored schemas. It will return those it can even if it has trouble with some.

func (*Storage) StoreSchema

func (ss *Storage) StoreSchema(schema StoredSchema) error

type StoredSchema

type StoredSchema struct {
	ID        string              `json:"id"`
	Schema    schema.VCJSONSchema `json:"schema"`
	SchemaJWT *keyaccess.JWT      `json:"token,omitempty"`
}

type VerifySchemaRequest

type VerifySchemaRequest struct {
	SchemaJWT keyaccess.JWT `json:"schemaJwt"`
}

type VerifySchemaResponse

type VerifySchemaResponse struct {
	Verified bool   `json:"verified"`
	Reason   string `json:"reason,omitempty"`
}

Jump to

Keyboard shortcuts

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