signing

package
v0.0.0-...-7c30539 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifySignature

func VerifySignature(pubKey crypto.PubKey, signingData SignerData, sigData signing.SignatureData, handler SignModeHandler, tx sdk.Tx) error

VerifySignature verifies a transaction signature contained in SignatureData abstracting over different signing modes and single vs multi-signatures.

Types

type SigFeeMemoTx

type SigFeeMemoTx interface {
	SigVerifiableTx
	types.TxWithMemo
	types.FeeTx
}

SigFeeMemoTx defines an interface for transactions that support all standard message, signature, fee and memo interfaces.

type SigVerifiableTx

type SigVerifiableTx interface {
	types.Tx
	GetSigners() []types.AccAddress
	GetPubKeys() []crypto.PubKey // If signer already has pubkey in context, this list will have nil in its place
	GetSignatures() [][]byte
	GetSignaturesV2() ([]signing.SignatureV2, error)
}

SigVerifiableTx defines a Tx interface for all signature verification decorators

type SignModeHandler

type SignModeHandler interface {
	// DefaultMode is the default mode that is to be used with this handler if no
	// other mode is specified. This can be useful for testing and CLI usage
	DefaultMode() signing.SignMode

	// Modes is the list of modes supporting by this handler
	Modes() []signing.SignMode

	// GetSignBytes returns the sign bytes for the provided SignMode, SignerData and Tx,
	// or an error
	GetSignBytes(mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error)
}

SignModeHandler defines a interface to be implemented by types which will handle SignMode's by generating sign bytes from a Tx and SignerData

type SignModeHandlerMap

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

SignModeHandlerMap is SignModeHandler that aggregates multiple SignModeHandler's into a single handler

func NewSignModeHandlerMap

func NewSignModeHandlerMap(defaultMode signing.SignMode, handlers []SignModeHandler) SignModeHandlerMap

NewSignModeHandlerMap returns a new SignModeHandlerMap with the provided defaultMode and handlers

func (SignModeHandlerMap) DefaultMode

func (h SignModeHandlerMap) DefaultMode() signing.SignMode

DefaultMode implements SignModeHandler.DefaultMode

func (SignModeHandlerMap) GetSignBytes

func (h SignModeHandlerMap) GetSignBytes(mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error)

DefaultMode implements SignModeHandler.GetSignBytes

func (SignModeHandlerMap) Modes

func (h SignModeHandlerMap) Modes() []signing.SignMode

Modes implements SignModeHandler.Modes

type SignerData

type SignerData struct {
	// ChainID is the chain that this transaction is targeted
	ChainID string

	// AccountNumber is the account number of the signer
	AccountNumber uint64

	// AccountSequence is the account sequence number of the signer that is used
	// for replay protection
	AccountSequence uint64
}

SignerData is the specific information needed to sign a transaction that generally isn't included in the transaction body itself

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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