signing

package
v0.41.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 5 Imported by: 1,201

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifySignature

func VerifySignature(pubKey cryptotypes.PubKey, signerData 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 SigVerifiableTx

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

SigVerifiableTx defines a transaction interface for all signature verification handlers.

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

	// Sequence is the account sequence number of the signer that is used
	// for replay protection. This field is only useful for Legacy Amino signing,
	// since in SIGN_MODE_DIRECT the account sequence is already in the signer
	// info.
	Sequence uint64
}

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

type Tx

Tx defines a transaction interface that supports all standard message, signature fee, memo, and auxiliary interfaces.

Jump to

Keyboard shortcuts

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