crypto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePresignSighash

func CalculatePresignSighash(sighash []byte, authType stacks.AuthType, fee uint64, nonce uint64) []byte

func CalculateSighash

func CalculateSighash(serializedTx []byte) []byte

func CalculateStacksAddress added in v0.2.0

func CalculateStacksAddress(pubKey []byte, network stacks.ChainID) (string, error)

func DeriveStxPrivateKey

func DeriveStxPrivateKey(mnemonic string, index uint32) ([]byte, error)

func GetAddressFromPrivateKey added in v0.2.0

func GetAddressFromPrivateKey(privateKey []byte, network stacks.ChainID) (string, error)

func GetPublicKeyFromPrivate

func GetPublicKeyFromPrivate(privateKey []byte) []byte

func Hash160

func Hash160(b []byte) []byte

func VerifySignature

func VerifySignature(messageHash string, signature MessageSignature, publicKey []byte) (bool, error)

Types

type MessageSignature

type MessageSignature struct {
	Type StacksMessageType
	Data string
}

func CreateMessageSignature

func CreateMessageSignature(signature string) (MessageSignature, error)

func SignWithKey

func SignWithKey(privateKey []byte, messageHash string) (MessageSignature, error)

type StacksMessageType

type StacksMessageType int
const (
	Address StacksMessageType = iota
	MessageSignatureType
)

type StacksPrivateKey

type StacksPrivateKey struct {
	Data       []byte
	Compressed bool
}

Jump to

Keyboard shortcuts

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