x

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 1 Imported by: 13

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 MainSigner

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

MainSigner returns the first permission if any, otherwise nil

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 hardcoding 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 Authenenticators

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 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 recipients.
Package distribution implements a revenue stream that is periodically distributing collected coins between defined recipients.
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 hashlock implements token locking.
Package hashlock implements token locking.
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 namecoin is an extension of x/cash from weave, allowing more information for wallets and tokens.
package namecoin is an extension of x/cash from weave, allowing more information for wallets and tokens.
nft
Package nft provides a core of a Non-fungible token implementation (NFT).
Package nft provides a core of a Non-fungible token implementation (NFT).
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.

Jump to

Keyboard shortcuts

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