multisig

package
v0.0.0-...-0a11024 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Package = amino.RegisterPackage(amino.NewPackage(
	"github.com/tendermint/classic/crypto/multisig",
	"tm",
	amino.GetCallersDirname(),
).WithDependencies().WithTypes(
	PubKeyMultisigThreshold{}, "PubKeyMultisig",
))

Functions

func IsPubKeyMultisigReprEmpty

func IsPubKeyMultisigReprEmpty(goor PubKeyMultisigThreshold) (empty bool)

func NewPubKeyMultisigThreshold

func NewPubKeyMultisigThreshold(k int, pubkeys []crypto.PubKey) crypto.PubKey

NewPubKeyMultisigThreshold returns a new PubKeyMultisigThreshold. Panics if len(pubkeys) < k or 0 >= k.

Types

type Multisignature

type Multisignature struct {
	BitArray *bitarray.CompactBitArray
	Sigs     [][]byte
}

Multisignature is used to represent the signature object used in the multisigs. Sigs is a list of signatures, sorted by corresponding index.

func NewMultisig

func NewMultisig(n int) *Multisignature

NewMultisig returns a new Multisignature of size n.

func (*Multisignature) AddSignature

func (mSig *Multisignature) AddSignature(sig []byte, index int)

AddSignature adds a signature to the multisig, at the corresponding index. If the signature already exists, replace it.

func (*Multisignature) AddSignatureFromPubKey

func (mSig *Multisignature) AddSignatureFromPubKey(sig []byte, pubkey crypto.PubKey, keys []crypto.PubKey) error

AddSignatureFromPubKey adds a signature to the multisig, at the index in keys corresponding to the provided pubkey.

func (*Multisignature) Marshal

func (mSig *Multisignature) Marshal() []byte

Marshal the multisignature with amino

type PubKeyMultisigThreshold

type PubKeyMultisigThreshold struct {
	K       uint            `json:"threshold"`
	PubKeys []crypto.PubKey `json:"pubkeys"`
}

PubKeyMultisigThreshold implements a K of N threshold multisig.

func (PubKeyMultisigThreshold) Address

func (pk PubKeyMultisigThreshold) Address() crypto.Address

Address returns tmhash(PubKeyMultisigThreshold.Bytes())

func (PubKeyMultisigThreshold) Bytes

func (pk PubKeyMultisigThreshold) Bytes() []byte

Bytes returns the amino encoded version of the PubKeyMultisigThreshold

func (PubKeyMultisigThreshold) EmptyPBMessage

func (goo PubKeyMultisigThreshold) EmptyPBMessage(cdc *amino.Codec) (msg proto.Message)

func (PubKeyMultisigThreshold) Equals

func (pk PubKeyMultisigThreshold) Equals(other crypto.PubKey) bool

Equals returns true iff pk and other both have the same number of keys, and all constituent keys are the same, and in the same order.

func (*PubKeyMultisigThreshold) FromPBMessage

func (goo *PubKeyMultisigThreshold) FromPBMessage(cdc *amino.Codec, msg proto.Message) (err error)

func (PubKeyMultisigThreshold) GetTypeURL

func (_ PubKeyMultisigThreshold) GetTypeURL() (typeURL string)

func (PubKeyMultisigThreshold) String

func (pk PubKeyMultisigThreshold) String() string

func (PubKeyMultisigThreshold) ToPBMessage

func (goo PubKeyMultisigThreshold) ToPBMessage(cdc *amino.Codec) (msg proto.Message, err error)

func (PubKeyMultisigThreshold) VerifyBytes

func (pk PubKeyMultisigThreshold) VerifyBytes(msg []byte, marshalledSig []byte) bool

VerifyBytes expects sig to be an amino encoded version of a MultiSignature. Returns true iff the multisignature contains k or more signatures for the correct corresponding keys, and all signatures are valid. (Not just k of the signatures) The multisig uses a bitarray, so multiple signatures for the same key is not a concern.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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