signing

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 1,668

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthSigning        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSigning          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSigning = fmt.Errorf("proto: unexpected end of group")
)
View Source
var SignMode_name = map[int32]string{
	0:   "SIGN_MODE_UNSPECIFIED",
	1:   "SIGN_MODE_DIRECT",
	2:   "SIGN_MODE_TEXTUAL",
	127: "SIGN_MODE_LEGACY_AMINO_JSON",
	191: "SIGN_MODE_EIP_191",
}
View Source
var SignMode_value = map[string]int32{
	"SIGN_MODE_UNSPECIFIED":       0,
	"SIGN_MODE_DIRECT":            1,
	"SIGN_MODE_TEXTUAL":           2,
	"SIGN_MODE_LEGACY_AMINO_JSON": 127,
	"SIGN_MODE_EIP_191":           191,
}

Functions

This section is empty.

Types

type MultiSignatureData

type MultiSignatureData struct {
	// BitArray is a compact way of indicating which signers from the multisig key
	// have signed
	BitArray *types.CompactBitArray

	// Signatures is the nested SignatureData's for each signer
	Signatures []SignatureData
}

MultiSignatureData represents the nested SignatureData of a multisig signature

type SignMode

type SignMode int32

SignMode represents a signing mode with its own security guarantees.

const (
	// SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be
	// rejected
	SignMode_SIGN_MODE_UNSPECIFIED SignMode = 0
	// SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is
	// verified with raw bytes from Tx
	SignMode_SIGN_MODE_DIRECT SignMode = 1
	// SIGN_MODE_TEXTUAL is a future signing mode that will verify some
	// human-readable textual representation on top of the binary representation
	// from SIGN_MODE_DIRECT
	SignMode_SIGN_MODE_TEXTUAL SignMode = 2
	// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
	// Amino JSON and will be removed in the future
	SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127
	// SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
	// SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
	//
	// Since: cosmos-sdk 0.45
	SignMode_SIGN_MODE_EIP_191 SignMode = 191
)

func (SignMode) EnumDescriptor

func (SignMode) EnumDescriptor() ([]byte, []int)

func (SignMode) String

func (x SignMode) String() string

type SignatureData

type SignatureData interface {
	// contains filtered or unexported methods
}

SignatureData represents either a *SingleSignatureData or *MultiSignatureData. It is a convenience type that is easier to use in business logic than the encoded protobuf ModeInfo's and raw signatures.

func SignatureDataFromProto

func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData

SignatureDataFromProto converts a SignatureDescriptor_Data to SignatureData. SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for business logic.

type SignatureDescriptor

type SignatureDescriptor struct {
	// public_key is the public key of the signer
	PublicKey *types.Any                `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	Data      *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// sequence is the sequence of the account, which describes the
	// number of committed transactions signed by a given address. It is used to prevent
	// replay attacks.
	Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"`
}

SignatureDescriptor is a convenience type which represents the full data for a signature including the public key of the signer, signing modes and the signature itself. It is primarily used for coordinating signatures between clients.

func (*SignatureDescriptor) Descriptor

func (*SignatureDescriptor) Descriptor() ([]byte, []int)

func (*SignatureDescriptor) GetData

func (*SignatureDescriptor) GetPublicKey

func (m *SignatureDescriptor) GetPublicKey() *types.Any

func (*SignatureDescriptor) GetSequence

func (m *SignatureDescriptor) GetSequence() uint64

func (*SignatureDescriptor) Marshal

func (m *SignatureDescriptor) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor) MarshalTo

func (m *SignatureDescriptor) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor) MarshalToSizedBuffer

func (m *SignatureDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor) ProtoMessage

func (*SignatureDescriptor) ProtoMessage()

func (*SignatureDescriptor) Reset

func (m *SignatureDescriptor) Reset()

func (*SignatureDescriptor) Size

func (m *SignatureDescriptor) Size() (n int)

func (*SignatureDescriptor) String

func (m *SignatureDescriptor) String() string

func (*SignatureDescriptor) Unmarshal

func (m *SignatureDescriptor) Unmarshal(dAtA []byte) error

func (*SignatureDescriptor) UnpackInterfaces

func (sd *SignatureDescriptor) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method

func (*SignatureDescriptor) XXX_DiscardUnknown

func (m *SignatureDescriptor) XXX_DiscardUnknown()

func (*SignatureDescriptor) XXX_Marshal

func (m *SignatureDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignatureDescriptor) XXX_Merge

func (m *SignatureDescriptor) XXX_Merge(src proto.Message)

func (*SignatureDescriptor) XXX_Size

func (m *SignatureDescriptor) XXX_Size() int

func (*SignatureDescriptor) XXX_Unmarshal

func (m *SignatureDescriptor) XXX_Unmarshal(b []byte) error

type SignatureDescriptor_Data

type SignatureDescriptor_Data struct {
	// sum is the oneof that specifies whether this represents single or multi-signature data
	//
	// Types that are valid to be assigned to Sum:
	//	*SignatureDescriptor_Data_Single_
	//	*SignatureDescriptor_Data_Multi_
	Sum isSignatureDescriptor_Data_Sum `protobuf_oneof:"sum"`
}

Data represents signature data

func SignatureDataToProto

func SignatureDataToProto(data SignatureData) *SignatureDescriptor_Data

SignatureDataToProto converts a SignatureData to SignatureDescriptor_Data. SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for business logic.

func (*SignatureDescriptor_Data) Descriptor

func (*SignatureDescriptor_Data) Descriptor() ([]byte, []int)

func (*SignatureDescriptor_Data) GetMulti

func (*SignatureDescriptor_Data) GetSingle

func (*SignatureDescriptor_Data) GetSum

func (m *SignatureDescriptor_Data) GetSum() isSignatureDescriptor_Data_Sum

func (*SignatureDescriptor_Data) Marshal

func (m *SignatureDescriptor_Data) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data) MarshalTo

func (m *SignatureDescriptor_Data) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data) ProtoMessage

func (*SignatureDescriptor_Data) ProtoMessage()

func (*SignatureDescriptor_Data) Reset

func (m *SignatureDescriptor_Data) Reset()

func (*SignatureDescriptor_Data) Size

func (m *SignatureDescriptor_Data) Size() (n int)

func (*SignatureDescriptor_Data) String

func (m *SignatureDescriptor_Data) String() string

func (*SignatureDescriptor_Data) Unmarshal

func (m *SignatureDescriptor_Data) Unmarshal(dAtA []byte) error

func (*SignatureDescriptor_Data) XXX_DiscardUnknown

func (m *SignatureDescriptor_Data) XXX_DiscardUnknown()

func (*SignatureDescriptor_Data) XXX_Marshal

func (m *SignatureDescriptor_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignatureDescriptor_Data) XXX_Merge

func (m *SignatureDescriptor_Data) XXX_Merge(src proto.Message)

func (*SignatureDescriptor_Data) XXX_OneofWrappers

func (*SignatureDescriptor_Data) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*SignatureDescriptor_Data) XXX_Size

func (m *SignatureDescriptor_Data) XXX_Size() int

func (*SignatureDescriptor_Data) XXX_Unmarshal

func (m *SignatureDescriptor_Data) XXX_Unmarshal(b []byte) error

type SignatureDescriptor_Data_Multi

type SignatureDescriptor_Data_Multi struct {
	// bitarray specifies which keys within the multisig are signing
	Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
	// signatures is the signatures of the multi-signature
	Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

Multi is the signature data for a multisig public key

func (*SignatureDescriptor_Data_Multi) Descriptor

func (*SignatureDescriptor_Data_Multi) Descriptor() ([]byte, []int)

func (*SignatureDescriptor_Data_Multi) GetBitarray

func (*SignatureDescriptor_Data_Multi) GetSignatures

func (*SignatureDescriptor_Data_Multi) Marshal

func (m *SignatureDescriptor_Data_Multi) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data_Multi) MarshalTo

func (m *SignatureDescriptor_Data_Multi) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi) ProtoMessage

func (*SignatureDescriptor_Data_Multi) ProtoMessage()

func (*SignatureDescriptor_Data_Multi) Reset

func (m *SignatureDescriptor_Data_Multi) Reset()

func (*SignatureDescriptor_Data_Multi) Size

func (m *SignatureDescriptor_Data_Multi) Size() (n int)

func (*SignatureDescriptor_Data_Multi) String

func (*SignatureDescriptor_Data_Multi) Unmarshal

func (m *SignatureDescriptor_Data_Multi) Unmarshal(dAtA []byte) error

func (*SignatureDescriptor_Data_Multi) XXX_DiscardUnknown

func (m *SignatureDescriptor_Data_Multi) XXX_DiscardUnknown()

func (*SignatureDescriptor_Data_Multi) XXX_Marshal

func (m *SignatureDescriptor_Data_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignatureDescriptor_Data_Multi) XXX_Merge

func (m *SignatureDescriptor_Data_Multi) XXX_Merge(src proto.Message)

func (*SignatureDescriptor_Data_Multi) XXX_Size

func (m *SignatureDescriptor_Data_Multi) XXX_Size() int

func (*SignatureDescriptor_Data_Multi) XXX_Unmarshal

func (m *SignatureDescriptor_Data_Multi) XXX_Unmarshal(b []byte) error

type SignatureDescriptor_Data_Multi_

type SignatureDescriptor_Data_Multi_ struct {
	Multi *SignatureDescriptor_Data_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"`
}

func (*SignatureDescriptor_Data_Multi_) MarshalTo

func (m *SignatureDescriptor_Data_Multi_) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi_) Size

func (m *SignatureDescriptor_Data_Multi_) Size() (n int)

type SignatureDescriptor_Data_Single

type SignatureDescriptor_Data_Single struct {
	// mode is the signing mode of the single signer
	Mode SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"`
	// signature is the raw signature bytes
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

Single is the signature data for a single signer

func (*SignatureDescriptor_Data_Single) Descriptor

func (*SignatureDescriptor_Data_Single) Descriptor() ([]byte, []int)

func (*SignatureDescriptor_Data_Single) GetMode

func (*SignatureDescriptor_Data_Single) GetSignature

func (m *SignatureDescriptor_Data_Single) GetSignature() []byte

func (*SignatureDescriptor_Data_Single) Marshal

func (m *SignatureDescriptor_Data_Single) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data_Single) MarshalTo

func (m *SignatureDescriptor_Data_Single) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Single) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single) ProtoMessage

func (*SignatureDescriptor_Data_Single) ProtoMessage()

func (*SignatureDescriptor_Data_Single) Reset

func (*SignatureDescriptor_Data_Single) Size

func (m *SignatureDescriptor_Data_Single) Size() (n int)

func (*SignatureDescriptor_Data_Single) String

func (*SignatureDescriptor_Data_Single) Unmarshal

func (m *SignatureDescriptor_Data_Single) Unmarshal(dAtA []byte) error

func (*SignatureDescriptor_Data_Single) XXX_DiscardUnknown

func (m *SignatureDescriptor_Data_Single) XXX_DiscardUnknown()

func (*SignatureDescriptor_Data_Single) XXX_Marshal

func (m *SignatureDescriptor_Data_Single) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignatureDescriptor_Data_Single) XXX_Merge

func (m *SignatureDescriptor_Data_Single) XXX_Merge(src proto.Message)

func (*SignatureDescriptor_Data_Single) XXX_Size

func (m *SignatureDescriptor_Data_Single) XXX_Size() int

func (*SignatureDescriptor_Data_Single) XXX_Unmarshal

func (m *SignatureDescriptor_Data_Single) XXX_Unmarshal(b []byte) error

type SignatureDescriptor_Data_Single_

type SignatureDescriptor_Data_Single_ struct {
	Single *SignatureDescriptor_Data_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"`
}

func (*SignatureDescriptor_Data_Single_) MarshalTo

func (m *SignatureDescriptor_Data_Single_) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single_) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single_) Size

func (m *SignatureDescriptor_Data_Single_) Size() (n int)

type SignatureDescriptors

type SignatureDescriptors struct {
	// signatures are the signature descriptors
	Signatures []*SignatureDescriptor `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

SignatureDescriptors wraps multiple SignatureDescriptor's.

func (*SignatureDescriptors) Descriptor

func (*SignatureDescriptors) Descriptor() ([]byte, []int)

func (*SignatureDescriptors) GetSignatures

func (m *SignatureDescriptors) GetSignatures() []*SignatureDescriptor

func (*SignatureDescriptors) Marshal

func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptors) MarshalTo

func (m *SignatureDescriptors) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptors) MarshalToSizedBuffer

func (m *SignatureDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptors) ProtoMessage

func (*SignatureDescriptors) ProtoMessage()

func (*SignatureDescriptors) Reset

func (m *SignatureDescriptors) Reset()

func (*SignatureDescriptors) Size

func (m *SignatureDescriptors) Size() (n int)

func (*SignatureDescriptors) String

func (m *SignatureDescriptors) String() string

func (*SignatureDescriptors) Unmarshal

func (m *SignatureDescriptors) Unmarshal(dAtA []byte) error

func (*SignatureDescriptors) UnpackInterfaces

func (sds *SignatureDescriptors) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method

func (*SignatureDescriptors) XXX_DiscardUnknown

func (m *SignatureDescriptors) XXX_DiscardUnknown()

func (*SignatureDescriptors) XXX_Marshal

func (m *SignatureDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignatureDescriptors) XXX_Merge

func (m *SignatureDescriptors) XXX_Merge(src proto.Message)

func (*SignatureDescriptors) XXX_Size

func (m *SignatureDescriptors) XXX_Size() int

func (*SignatureDescriptors) XXX_Unmarshal

func (m *SignatureDescriptors) XXX_Unmarshal(b []byte) error

type SignatureV2

type SignatureV2 struct {
	// PubKey is the public key to use for verifying the signature
	PubKey cryptotypes.PubKey

	// Data is the actual data of the signature which includes SignMode's and
	// the signatures themselves for either single or multi-signatures.
	Data SignatureData

	// Sequence is the sequence of this account. Only populated in
	// SIGN_MODE_DIRECT.
	Sequence uint64
}

SignatureV2 is a convenience type that is easier to use in application logic than the protobuf SignerInfo's and raw signature bytes. It goes beyond the first sdk.Signature types by supporting sign modes and explicitly nested multi-signatures. It is intended to be used for both building and verifying signatures.

type SingleSignatureData

type SingleSignatureData struct {
	// SignMode represents the SignMode of the signature
	SignMode SignMode

	// SignMode represents the SignMode of the signature
	Signature []byte
}

SingleSignatureData represents the signature and SignMode of a single (non-multisig) signer

Jump to

Keyboard shortcuts

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