handler

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLHandler

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

TODO: add all access control handlers

func NewACLHandler

func NewACLHandler(acl *contracts.ACL) ACLHandler

func (*ACLHandler) HasRole

func (handler *ACLHandler) HasRole(ctx *fiber.Ctx) error

type Account

type Account struct {
	Role    Role   `json:"role,omitempty"`
	Address string `json:"address,omitempty"`
}

type BasicHandler

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

func NewBasicHandler

func NewBasicHandler(contractClient *contracts.Depository, h depositories.Interface) BasicHandler

func (*BasicHandler) CurrentNonce

func (h *BasicHandler) CurrentNonce(ctx *fiber.Ctx) error

func (*BasicHandler) Get

func (h *BasicHandler) Get(ctx *fiber.Ctx) error

func (*BasicHandler) GetDepositoryCertificate

func (h *BasicHandler) GetDepositoryCertificate(ctx *fiber.Ctx) error

func (*BasicHandler) GetValue

func (h *BasicHandler) GetValue(ctx *fiber.Ctx) error

func (*BasicHandler) List

func (h *BasicHandler) List(ctx *fiber.Ctx) error

func (*BasicHandler) PutUntrustValue

func (h *BasicHandler) PutUntrustValue(ctx *fiber.Ctx) error

func (*BasicHandler) PutValue

func (h *BasicHandler) PutValue(ctx *fiber.Ctx) error

func (*BasicHandler) Total

func (h *BasicHandler) Total(ctx *fiber.Ctx) error

Total

func (*BasicHandler) VerifyValue

func (h *BasicHandler) VerifyValue(ctx *fiber.Ctx) error

type HFHandler

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

func NewHyperledgerHandler

func NewHyperledgerHandler(hf *contracts.Hyperledger) HFHandler

func (*HFHandler) GetMetadata

func (handler *HFHandler) GetMetadata(ctx *fiber.Ctx) error

type KeyValue

type KeyValue struct {
	Index string `json:"index,omitempty"`
	KID   string `json:"kid,omitempty"`
	Value string `json:"value,omitempty"`
	// Message is a base64 encoded string of utils.Message
	Message string `json:"message,omitempty"`
}

KeyValue defines common key-value fields for a depository

type MarketHandler

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

func NewMarketHandler

func NewMarketHandler(contractClient *contracts.Market) *MarketHandler

NewMarketHandler creates a new instance of MarketHandler.

It takes a pointer to a Market contract and returns a pointer to a MarketHandler.

func (*MarketHandler) CreateRepo

func (lh *MarketHandler) CreateRepo(ctx *fiber.Ctx) error

CreateRepo creates a new repository with a market in the given URL.

ctx: Context from the request. Returns an error if there is a bad request or internal server error.

func (*MarketHandler) CurrentNonce

func (lh *MarketHandler) CurrentNonce(ctx *fiber.Ctx) error

CurrentNonce returns the current nonce for the given account.

func (*MarketHandler) GetRepos

func (lh *MarketHandler) GetRepos(ctx *fiber.Ctx) error

GetRepos returns a list of repositories from the MarketHandler's market instance

func (*MarketHandler) UpdateRepo

func (lh *MarketHandler) UpdateRepo(ctx *fiber.Ctx) error

UpdateRepo updates the repository with the given ID and URL. It expects a JSON-encoded body containing a Repository object. Returns a JSON response with the updated repository ID and URL.

type Metadata

type Metadata struct {
	Content []byte `json:"content,omitempty"`
}

type Repository

type Repository struct {
	ID string `json:"id"`
	// URL of this repository
	URL string `json:"url,omitempty"`
	// Message is a base64 encoded string of utils.Message
	Message string `json:"message,omitempty"`
}

KeyValue defines common key-value fields for a depository

type Role

type Role string
const (
	RoleAdmin  Role = "role~admin"
	RoleClient Role = "role~client"
)

func (Role) Hashed

func (role Role) Hashed() []byte

type ValueDepository

type ValueDepository struct {
	Name        string `json:"name"`
	ContentName string `json:"contentName"`
	ContentType string `json:"contentType"`
	ContentID   string `json:"contentID"` // hash of the file

	// ContentSize the size of file. unit is byte
	ContentSize      int64  `json:"contentSize"`
	TrustedTimestamp string `json:"trustedTimestamp"`
	Platform         string `json:"platform"`
	Description      string `json:"description,omitempty"`
}

ValueDepository defines valuable fields for a depository

type VerifyStatus

type VerifyStatus struct {
	Status bool   `json:"status"`
	Reason string `json:"reason"`
}

VerifyStatus defines response fields for a depository verification

Jump to

Keyboard shortcuts

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