x

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 1 Imported by: 11

Documentation

Overview

Package x contains some standard extensions

Extensions implement common functionality (Handler, Decorator, etc.) and can be combined together to construct an application

All sub-packages are various extensions, useful to build applications, but not necessary to use the framework. All of them provide functionality commonly needed by blockchains. You are welcome to import them if desired, but if they don't match your particular needs, you may also write your own extensions and use them instead.

Note that protobuf types in exported code will be prefixed by the package, so follow standard go naming conventions and avoid stutter. Use eg. `escrow.CreateMsg` in place of `escrow.CreateMsg`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnySigner added in v0.23.0

func AnySigner(ctx weave.Context, auth Authenticator) weave.Condition

AnySigner returns a permission or nil.

This function returns always the first condition as defined in the transaction. Using this function can introduce a security hole. One must never assume the order of transaction signatures, because those are not part of signed content. Order of signatures in transaction can be altered at any time.

This function is deprecated and must not be used for new implementations.

func GetAddresses added in v0.3.0

func GetAddresses(ctx weave.Context, auth Authenticator) []weave.Address

GetAddresses wraps the GetConditions method of any Authenticator

func HasAllAddresses added in v0.3.0

func HasAllAddresses(ctx weave.Context, auth Authenticator, required []weave.Address) bool

HasAllAddresses returns true if all elements in required are also in context.

func HasAllConditions added in v0.4.0

func HasAllConditions(ctx weave.Context, auth Authenticator, required []weave.Condition) bool

HasAllConditions returns true if all elements in required are also in context.

func HasNAddresses added in v0.8.0

func HasNAddresses(ctx weave.Context, auth Authenticator, required []weave.Address, n int) bool

HasNAddresses returns true if at least n elements in requested are also in context.

func HasNConditions added in v0.4.0

func HasNConditions(ctx weave.Context, auth Authenticator, requested []weave.Condition, n int) bool

HasNConditions returns true if at least n elements in requested are also in context. Useful for threshold conditions (1 of 3, 3 of 5, etc...)

func MarshalValid

func MarshalValid(obj MarshalValidater) ([]byte, error)

MarshalValid validates the object, then marshals

func MustMarshal

func MustMarshal(obj weave.Marshaller) []byte

MustMarshal will succeed or panic

func MustMarshalValid

func MustMarshalValid(obj MarshalValidater) []byte

MustMarshalValid marshals the object, but panics if the object is not valid or has trouble marshalling

func MustUnmarshal

func MustUnmarshal(obj weave.Persistent, bz []byte)

MustUnmarshal will succeed or panic

func MustValidate

func MustValidate(obj Validater)

MustValidate panics if the object is not valid

Types

type Authenticator

type Authenticator interface {
	// GetConditions reveals all Conditions fulfilled,
	// you may want GetAddresses helper
	GetConditions(weave.Context) []weave.Condition
	// HasAddress checks if any condition matches this address
	HasAddress(weave.Context, weave.Address) bool
}

Authenticator is an interface we can use to extract authentication info from the context. This should be passed into the constructor of handlers, so we can plug in another authentication system, rather than hard-coding x/auth for all extensions.

type MarshalValidater

type MarshalValidater interface {
	weave.Marshaller
	Validater
}

MarshalValidater is something that can be validated and serialized

type MultiAuth

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

MultiAuth chains together many Authenticators into one

func ChainAuth

func ChainAuth(impls ...Authenticator) MultiAuth

ChainAuth groups together a series of Authenticator

func (MultiAuth) GetConditions added in v0.4.0

func (m MultiAuth) GetConditions(ctx weave.Context) []weave.Condition

GetConditions combines all Conditions from all Authenticators

func (MultiAuth) HasAddress added in v0.3.0

func (m MultiAuth) HasAddress(ctx weave.Context, addr weave.Address) bool

HasAddress returns true iff any Authenticator support this

type Validater

type Validater interface {
	Validate() error
}

Validater is any struct that can be validated. Not the same as a Validator, which votes on the blocks.

Directories

Path Synopsis
Package aswap implements an atomic swap.
Package aswap implements an atomic swap.
Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions.
Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions.
Package cash defines a simple implementation of sending coins between multi-signature wallets.
Package cash defines a simple implementation of sending coins between multi-signature wallets.
Package cron implements delayed message execution.
Package cron implements delayed message execution.
Package currency provides an implementation of a token registry.
Package currency provides an implementation of a token registry.
Package distribution implements a revenue stream that is periodically distributing collected coins between defined destinations.
Package distribution implements a revenue stream that is periodically distributing collected coins between defined destinations.
Package escrow implements an Escrow.
Package escrow implements an Escrow.
Package gov contains on chain governance process protocols.
Package gov contains on chain governance process protocols.
Package msgfee allows to define and charge an additional fee per transaction type.
Package msgfee allows to define and charge an additional fee per transaction type.
> Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document.
> Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document.
Package paychan implements payment side channel functionality.
Package paychan implements payment side channel functionality.
Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection.
Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection.
Package txfee implements a fee middleware that computes an additional transaction fee, depending on each transaction binary size.
Package txfee implements a fee middleware that computes an additional transaction fee, depending on each transaction binary size.

Jump to

Keyboard shortcuts

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