Documentation ¶
Index ¶
- func APISignModeToInternal(mode signingv1beta1.SignMode) (signing.SignMode, error)
- func APISignModesToInternal(modes []signingv1beta1.SignMode) ([]signing.SignMode, error)
- func GetSignBytesAdapter(ctx context.Context, handlerMap *txsigning.HandlerMap, mode signing.SignMode, ...) ([]byte, error)
- func VerifySignature(ctx context.Context, pubKey cryptotypes.PubKey, ...) error
- type SigVerifiableTx
- type SignModeHandler
- type SignModeHandlerMap
- func (h SignModeHandlerMap) DefaultMode() signing.SignMode
- func (h SignModeHandlerMap) GetSignBytes(mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error)
- func (h SignModeHandlerMap) GetSignBytesWithContext(ctx context.Context, mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error)
- func (h SignModeHandlerMap) Modes() []signing.SignMode
- type SignModeHandlerWithContext
- type SignerData
- type Tx
- type V2AdaptableTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APISignModeToInternal ¶ added in v0.50.1
func APISignModeToInternal(mode signingv1beta1.SignMode) (signing.SignMode, error)
APISignModeToInternal converts a protobuf SignMode to a signing.SignMode.
func APISignModesToInternal ¶ added in v0.50.1
func APISignModesToInternal(modes []signingv1beta1.SignMode) ([]signing.SignMode, error)
APISignModesToInternal converts a protobuf SignMode array to a signing.SignMode array.
func GetSignBytesAdapter ¶ added in v0.50.1
func GetSignBytesAdapter( ctx context.Context, handlerMap *txsigning.HandlerMap, mode signing.SignMode, signerData SignerData, tx sdk.Tx, ) ([]byte, error)
GetSignBytesAdapter returns the sign bytes for a given transaction and sign mode. It accepts the arguments expected for signing in x/auth/tx and converts them to the arguments expected by the txsigning.HandlerMap, then applies HandlerMap.GetSignBytes to get the sign bytes.
func VerifySignature ¶
func VerifySignature( ctx context.Context, pubKey cryptotypes.PubKey, signerData txsigning.SignerData, signatureData signing.SignatureData, handler *txsigning.HandlerMap, txData txsigning.TxData, ) error
VerifySignature verifies a transaction signature contained in SignatureData abstracting over different signing modes. It differs from VerifySignature in that it uses the new txsigning.TxData interface in x/tx.
Types ¶
type SigVerifiableTx ¶
type SigVerifiableTx interface { types.Tx GetSigners() ([][]byte, error) GetPubKeys() ([]cryptotypes.PubKey, error) // 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)
GetSignBytes implements SignModeHandler.GetSignBytes
func (SignModeHandlerMap) GetSignBytesWithContext ¶ added in v0.50.1
func (h SignModeHandlerMap) GetSignBytesWithContext(ctx context.Context, mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error)
GetSignBytesWithContext implements SignModeHandler.GetSignBytesWithContext
func (SignModeHandlerMap) Modes ¶
func (h SignModeHandlerMap) Modes() []signing.SignMode
Modes implements SignModeHandler.Modes
type SignModeHandlerWithContext ¶ added in v0.50.1
type SignModeHandlerWithContext interface { SignModeHandler // GetSignBytes returns the sign bytes for the provided SignMode, SignerData and Tx, // or an error GetSignBytesWithContext(ctx context.Context, mode signing.SignMode, data SignerData, tx sdk.Tx) ([]byte, error) }
SignModeHandlerWithContext is like SignModeHandler, with a new GetSignBytes method which takes an additional context.Context argument, to be used to access state. Consumers should preferably type-cast to this interface and pass in the context.Context arg, and default to SignModeHandler otherwise. This interface is created for backwards compatibility, and will be deleted once SDK versions <v0.47 are not supported anymore.
type SignerData ¶
type SignerData struct { // The address of the signer. // // In case of multisigs, this should be the multisig's address. Address string // ChainID is the chain that this transaction is targeted ChainID string // AccountNumber is the account number of the signer. // // In case of multisigs, this should be the multisig account number. 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. // // In case of multisigs, this should be the multisig sequence. Sequence uint64 // PubKey is the public key of the signer. // // In case of multisigs, this should be the pubkey of the member of the // multisig that is signing the current sign doc. PubKey cryptotypes.PubKey }
SignerData is the specific information needed to sign a transaction that generally isn't included in the transaction body itself
type Tx ¶
type Tx interface { SigVerifiableTx types.TxWithMemo types.FeeTx types.TxWithTimeoutHeight types.HasValidateBasic }
Tx defines a transaction interface that supports all standard message, signature fee, memo and auxiliary interfaces.
type V2AdaptableTx ¶ added in v0.50.1
V2AdaptableTx is an interface that wraps the GetSigningTxData method. GetSigningTxData returns an x/tx/signing.TxData representation of a transaction for use in signing interoperability with x/tx.