hashlock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreimageCondition

func PreimageCondition(preimage []byte) weave.Condition

PreimageCondition calculates a sha256 hash and then

Types

type Authenticate

type Authenticate struct{}

Authenticate implements x.Authenticator and provides authentication based on public-key signatures.

func (Authenticate) GetConditions

func (a Authenticate) GetConditions(ctx weave.Context) []weave.Condition

GetConditions returns which preimages have authorized the current Context. May be nil

func (Authenticate) HasAddress

func (a Authenticate) HasAddress(ctx weave.Context, addr weave.Address) bool

HasAddress returns true if the given address had the preimage permission in the current Context.

type Decorator

type Decorator struct{}

Decorator adds permissions to context based on preimages

func NewDecorator

func NewDecorator() Decorator

NewDecorator returns a default hashlock decorator

func (Decorator) Check

func (d Decorator) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx,
	next weave.Checker) (weave.CheckResult, error)

Check verifies signatures before calling down the stack

func (Decorator) Deliver

func (d Decorator) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx,
	next weave.Deliverer) (weave.DeliverResult, error)

Deliver verifies signatures before calling down the stack

type HashKeyTx

type HashKeyTx interface {
	// GetPreimage should return a hash preimage if provided
	// or nil if not included in this tx
	GetPreimage() []byte
}

HashKeyTx is an optional interface for a Tx that allows it to provide Keys (Preimages) to open HashLocks

Jump to

Keyboard shortcuts

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