signature

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sender

func Sender(signer TxSigner, tx *types.Transaction) (types.Address, error)

func Sign

func Sign(signer Signer, data []byte) ([]byte, error)

Sing the data by singer

func Verify

func Verify(pubKey keypair.PublicKey, signature []byte) (types.Address, error)

Verify check the signature of data using pubKey

func VerifyMultiSignature

func VerifyMultiSignature(data []byte, keys []keypair.PublicKey, m int, sigs [][]byte) error

VerifyMultiSignature check whether more than m sigs are signed by the keys

Types

type Signature

type Signature struct {
	Scheme keypair.SignatureScheme
	Value  interface{}
}

type Signer

type Signer interface {
	//get signer's private key
	PrivKey() keypair.PrivateKey

	//get signer's public key
	PubKey() keypair.PublicKey

	Scheme() keypair.SignatureScheme
}

Signer is the abstract interface of user's information(Keys) for signing data.

type TxSigner

type TxSigner interface {
	// Sender returns the sender address of the transaction.
	Sender(tx *types.Transaction) (types.Address, error)

	// SignatureValues returns the raw R, S, V values corresponding to the
	// given signature.
	SignatureValues(tx *types.Transaction, sig []byte) (r, s, v *big.Int, err error)

	// Hash returns the hash to be signed.
	Hash(tx *types.Transaction) types.Hash

	// Equal returns true if the given signer is the same as the receiver.
	Equal(TxSigner) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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