sigs

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 15 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 Account

type Account struct {
	SK      *btcSecp256k1.PrivateKey
	PubKey  cryptotypes.PubKey
	Addr    sdk.AccAddress
	ConsKey cryptotypes.PrivKey
	Vault   *Account // provider vault account (only for provider)
	// contains filtered or unexported fields
}

func GenerateDeterministicFloatingKey

func GenerateDeterministicFloatingKey(rand io.Reader) (acc Account)

GenerateDeterministicFloatingKey creates a new private key with an account address derived from the corresponding public key using a rand source

func (Account) GetVaultAddr

func (acc Account) GetVaultAddr() string

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
}

type ZeroReader

type ZeroReader struct {
	Seed byte
	// contains filtered or unexported fields
}

func NewZeroReader

func NewZeroReader(seed int64) *ZeroReader

func (*ZeroReader) Inc

func (z *ZeroReader) Inc()

func (ZeroReader) Read

func (z ZeroReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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