sigs

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeUint64

func EncodeUint64(val uint64) []byte

EncodeUint64 encodes a uint64 value to a byte array

func ExtractSignerAddress

func ExtractSignerAddress(data Signable) (sdk.AccAddress, error)

ExtractSignerAddress extracts the signer address of data

func GenerateFloatingKey

func GenerateFloatingKey() (secretKey *btcSecp256k1.PrivateKey, addr sdk.AccAddress)

GenerateFloatingKey creates a new private key with an account address derived from the corresponding public key

func GetKeyName

func GetKeyName(clientCtx client.Context) (string, error)

func GetPrivKey

func GetPrivKey(clientCtx client.Context, keyName string) (*btcSecp256k1.PrivateKey, error)

func HashMsg

func HashMsg(msgData []byte) []byte

HashMsg hashes msgData using SHA-256

func Join

func Join(s [][]byte) []byte

Join() is faster than bytes.Join because it does what bytes.Join() does without appending (empty) separators

func RecoverPubKey

func RecoverPubKey(data Signable) (secp256k1.PubKey, error)

RecoverPubKey recovers the public key from data's signature

func Sign

func Sign(pkey *btcSecp256k1.PrivateKey, data Signable) ([]byte, error)

Sign creates a signature for a struct. The prepareFunc prepares the struct before extracting the data for the signature

Types

type Signable

type Signable interface {
	// GetSignature gets the object's signature
	GetSignature() []byte
	// DataToSign processes the object's data before it's hashed and signed
	DataToSign() []byte
	// HashRounds gets the number of times the object's data is hashed before it's signed
	HashRounds() int
}

Jump to

Keyboard shortcuts

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