signing

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 12 Imported by: 301

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetSignersContext added in v0.2.1

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

GetSignersContext is a context for retrieving the list of signers from a message where signers are specified by the cosmos.msg.v1.signer protobuf option.

func NewGetSignersContext added in v0.2.1

func NewGetSignersContext(options GetSignersOptions) (*GetSignersContext, error)

NewGetSignersContext creates a new GetSignersContext using the provided options.

func (*GetSignersContext) GetSigners added in v0.2.1

func (c *GetSignersContext) GetSigners(msg proto.Message) ([]string, error)

GetSigners returns the signers for a given message.

type GetSignersOptions added in v0.2.1

type GetSignersOptions struct {
	// ProtoFiles are the protobuf files to use for resolving message descriptors.
	// If it is nil, the global protobuf registry will be used.
	ProtoFiles ProtoFileResolver
}

GetSignersOptions are options for creating GetSignersContext.

type HandlerMap added in v0.2.0

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

HandlerMap aggregates several sign mode handlers together for convenient generation of sign bytes based on sign mode.

func NewHandlerMap added in v0.2.0

func NewHandlerMap(handlers ...SignModeHandler) *HandlerMap

NewHandlerMap constructs a new sign mode handler map.

func (*HandlerMap) GetSignBytes added in v0.2.0

func (h *HandlerMap) GetSignBytes(ctx context.Context, signMode signingv1beta1.SignMode, signerData SignerData, txData TxData) ([]byte, error)

GetSignBytes returns the sign bytes for the transaction for the requested mode.

func (*HandlerMap) SupportedModes added in v0.2.0

func (h *HandlerMap) SupportedModes() []signingv1beta1.SignMode

SupportedModes lists the modes supported by this handler map.

type ProtoFileResolver added in v0.5.0

type ProtoFileResolver interface {
	protodesc.Resolver
	RangeFiles(func(protoreflect.FileDescriptor) bool)
}

ProtoFileResolver is a protodesc.Resolver that also allows iterating over all files descriptors. It is a subset of the methods supported by protoregistry.Files.

type SignModeHandler added in v0.2.0

type SignModeHandler interface {
	// Mode is the sign mode supported by this handler
	Mode() signingv1beta1.SignMode

	// GetSignBytes returns the sign bytes for the provided SignerData and TxData, or an error.
	GetSignBytes(ctx context.Context, signerData SignerData, txData TxData) ([]byte, error)
}

SignModeHandler is the interface that handlers for each sign mode should implement to generate sign bytes.

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 targeting.
	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 *anypb.Any
}

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

type TxData added in v0.2.0

type TxData struct {
	// Body is the TxBody that will be part of the transaction.
	Body *txv1beta1.TxBody

	// AuthInfo is the AuthInfo that will be part of the transaction.
	AuthInfo *txv1beta1.AuthInfo

	// BodyBytes is the marshaled body bytes that will be part of TxRaw.
	BodyBytes []byte

	// AuthInfoBytes is the marshaled AuthInfo bytes that will be part of TxRaw.
	AuthInfoBytes []byte

	// BodyHasUnknownNonCriticals should be set to true if the transaction has been
	// decoded and found to have unknown non-critical fields. This is only needed
	// for amino JSON signing.
	BodyHasUnknownNonCriticals bool
}

TxData is the data about a transaction that is necessary to generate sign bytes.

Directories

Path Synopsis
internal/aminojsonpb
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
internal/testpb
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
internal/cbor
Package cbor implements just enough of the CBOR (Concise Binary Object Representation, RFC 8948) to deterministically encode simple data.
Package cbor implements just enough of the CBOR (Concise Binary Object Representation, RFC 8948) to deterministically encode simple data.
internal/textualpb
Package textualpb contains all protobuf definitions and generated codes used internally by Textual.
Package textualpb contains all protobuf definitions and generated codes used internally by Textual.

Jump to

Keyboard shortcuts

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