schema

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSchemaRequest

type CreateSchemaRequest struct {
	Name        string            `json:"name" validate:"required"`
	Description string            `json:"description,omitempty"`
	Schema      schema.JSONSchema `json:"schema" validate:"required"`

	// If sign == true, the schema will be signed by the author's private key with the specified KID
	Sign      bool   `json:"sign,omitempty"`
	Issuer    string `json:"issuer,omitempty"`
	IssuerKID string `json:"issuerKid,omitempty"`
}

func (CreateSchemaRequest) IsValid

func (csr CreateSchemaRequest) IsValid() bool

type CreateSchemaResponse

type CreateSchemaResponse struct {
	ID     string            `json:"id"`
	Schema schema.JSONSchema `json:"schema"`
}

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.JSONSchema `json:"schema"`
}

type ListSchemasResponse

type ListSchemasResponse 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 resolution.Resolver) (*Service, error)

func (Service) Config

func (s Service) Config() config.SchemaServiceConfig

func (Service) CreateSchema

func (s Service) CreateSchema(ctx context.Context, 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 SchemaID specification. TODO(gabe) support data integrity proofs for credential schemas

func (Service) DeleteSchema

func (s Service) DeleteSchema(ctx context.Context, request DeleteSchemaRequest) error

func (Service) GetSchema

func (s Service) GetSchema(ctx context.Context, request GetSchemaRequest) (*GetSchemaResponse, error)

func (Service) ListSchemas

func (s Service) ListSchemas(ctx context.Context) (*ListSchemasResponse, error)

func (Service) Resolve

func (s Service) Resolve(ctx context.Context, id string) (*schema.JSONSchema, error)

Resolve wraps our get schema method for exposing schema access to other services

func (Service) Status

func (s Service) Status() framework.Status

func (Service) Type

func (s Service) Type() framework.Type

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(ctx context.Context, id string) error

func (*Storage) GetSchema

func (ss *Storage) GetSchema(ctx context.Context, id string) (*StoredSchema, error)

func (*Storage) ListSchemas

func (ss *Storage) ListSchemas(ctx context.Context) ([]StoredSchema, error)

ListSchemas 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(ctx context.Context, schema StoredSchema) error

type StoredSchema

type StoredSchema struct {
	ID     string            `json:"id"`
	Schema schema.JSONSchema `json:"schema"`
}

Jump to

Keyboard shortcuts

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