dapp

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidSignature = errors.New("failed to verify signature for DApp")

Functions

This section is empty.

Types

type BoltDAppStorage

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

func NewDAppStorage

func NewDAppStorage(db *storm.DB, api *uiapi.Api) *BoltDAppStorage

func (*BoltDAppStorage) All

func (s *BoltDAppStorage) All() ([]*Data, error)

func (*BoltDAppStorage) Get

func (s *BoltDAppStorage) Get(signingKey ed25519.PublicKey) (*Data, error)

func (*BoltDAppStorage) SaveDApp

func (s *BoltDAppStorage) SaveDApp(dApp Data) error

type DApp

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

func New

func New(l *logger.Logger, app *Data, vmModules []module.Module, closer chan<- *Data, timeOut time.Duration, db *storm.DB) (*DApp, error)

will start a DApp based on the given config file

func (*DApp) CallFunction

func (d *DApp) CallFunction(id uint, args string) error

func (*DApp) Close

func (d *DApp) Close()

close DApp

func (*DApp) ID

func (d *DApp) ID() string

func (*DApp) OpenDApp

func (d *DApp) OpenDApp(context string) error

func (*DApp) RenderMessage

func (d *DApp) RenderMessage(payload string) (string, error)

type Data

type Data struct {
	Name           map[string]string
	UsedSigningKey ed25519.PublicKey `storm:"id"`
	Code           []byte
	Image          []byte
	Signature      []byte
	Engine         SV
	Version        int
}

JSON Representation of published DApp

func ParseJsonToData

func ParseJsonToData(b RawData) (Data, error)

func (Data) Hash

func (r Data) Hash() ([]byte, error)

hash the published DApp

func (Data) Marshal

func (r Data) Marshal() ([]byte, error)

func (Data) VerifySignature

func (r Data) VerifySignature() (bool, error)

verify if this published DApp was signed with the attached public key

type RawData

type RawData struct {
	Name           map[string]string `json:"name"`
	UsedSigningKey string            `json:"used_signing_key"`
	Code           string            `json:"code"`
	Image          string            `json:"image"`
	Signature      string            `json:"signature"`
	Engine         string            `json:"engine"`
	Version        string            `json:"version"`
}

type SV

type SV struct {
	Major uint `json:"major"`
	Minor uint `json:"minor"`
	Patch uint `json:"patch"`
}

func (*SV) String

func (v *SV) String() string

type Storage

type Storage interface {
	SaveDApp(dApp Data) error
	All() ([]*Data, error)
	Get(signingKey ed25519.PublicKey) (*Data, error)
}

Jump to

Keyboard shortcuts

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