bip

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirstHardenedChild        = uint32(0x80000000)
	PublicKeyCompressedLength = 33
)

Variables

View Source
var (
	PrivateWalletVersionDefault, _  = hex.DecodeString("0488ADE4")
	PrivateWalletVersionForKaspa, _ = hex.DecodeString("038F2EF4")
	PublicWalletVersionDefault, _   = hex.DecodeString("0488B21E")
	ErrSerializedKeyWrongSize       = errors.New("Serialized keys should by exactly 82 bytes")
	ErrHardnedChildPublicKey        = errors.New("Can't create hardened child for public key")
	ErrInvalidChecksum              = errors.New("Checksum doesn't match")
	ErrInvalidPrivateKey            = errors.New("Invalid private key")
	ErrInvalidPublicKey             = errors.New("Invalid public key")
)
View Source
var (
	ErrInvalidMnemonic             = errors.New("Invalid mnenomic")
	ErrEntropyLengthInvalid        = errors.New("Entropy length must be [128, 256] and a multiple of 32")
	ErrValidatedSeedLengthMismatch = errors.New("Seed length does not match validated seed length")
	ErrChecksumIncorrect           = errors.New("Checksum incorrect")
)
View Source
var (
	BitcoinBase58Encoding = basen.NewEncoding("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
)
View Source
var English = strings.Split(strings.TrimSpace(english), "\n")
View Source
var ReverseWordMap = map[string]int{}

Functions

func EntropyFromMnemonic

func EntropyFromMnemonic(mnemonic string) ([]byte, error)

func GetWordList

func GetWordList() []string

func IsMnemonicValid

func IsMnemonicValid(mnemonic string) bool

func MnemonicToByteArray

func MnemonicToByteArray(mnemonic string, raw ...bool) ([]byte, error)

func NewEntropy

func NewEntropy(bitSize int) ([]byte, error)

func NewMnemonic

func NewMnemonic(entropy []byte) (string, error)

func NewSeed

func NewSeed(mnemonic string, password string) []byte

func NewSeedFromMnemonicSr25519

func NewSeedFromMnemonicSr25519(mnemonic string, password string) ([64]byte, error)

func NewSeedWithErrorChecking

func NewSeedWithErrorChecking(mnemonic string, password string) ([]byte, error)

func SetWordList

func SetWordList(list []string)

Types

type Key

type Key struct {
	Key         []byte
	Version     []byte
	ChildNumber []byte
	FingerPrint []byte
	ChainCode   []byte
	Depth       [1]byte
	IsPrivate   bool
}

func B58Deserialize

func B58Deserialize(data string) (*Key, error)

func Deserialize

func Deserialize(data []byte) (*Key, error)

func NewMasterKey

func NewMasterKey(seed []byte, version []byte) (*Key, error)

func NewMasterKeyED25519

func NewMasterKeyED25519(seed []byte) (*Key, error)

func SeedToKeyForECDSA

func SeedToKeyForECDSA(seed []byte, path string) (*Key, error)

func SeedToKeyForED25519

func SeedToKeyForED25519(seed []byte, path string) (*Key, error)

func (*Key) B58Serialize

func (key *Key) B58Serialize() string

func (*Key) CompressedPublicKey

func (key *Key) CompressedPublicKey() *Key

func (*Key) NewChildKey

func (key *Key) NewChildKey(childIdx uint32) (*Key, error)

func (*Key) NewChildKeyED25519

func (key *Key) NewChildKeyED25519(childIdx uint32) (*Key, error)

func (*Key) Serialize

func (key *Key) Serialize() ([]byte, error)

func (*Key) String

func (key *Key) String() string

func (*Key) UncompressedPublicKey

func (key *Key) UncompressedPublicKey() *Key

Jump to

Keyboard shortcuts

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