keys

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: LGPL-3.0 Imports: 12 Imported by: 12

Documentation

Overview

Package keys provides key management utilities for TRON accounts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewKey

func AddNewKey(password string)

AddNewKey creates a new account in the default keystore directory.

func FromMnemonicSeedAndPassphrase deprecated

func FromMnemonicSeedAndPassphrase(m, passphrase string, index int) (*btcec.PrivateKey, *btcec.PublicKey)

Deprecated: Use mnemonic.FromSeedAndPassphrase instead.

func GenerateKey added in v0.24.1

func GenerateKey() (*btcec.PrivateKey, error)

GenerateKey generates a new random secp256k1 private key.

func GetPrivateKeyFromBytes added in v0.24.1

func GetPrivateKeyFromBytes(privateKeyBytes []byte) (*btcec.PrivateKey, error)

GetPrivateKeyFromBytes creates a private key from raw 32-byte key material.

func GetPrivateKeyFromHex added in v0.24.1

func GetPrivateKeyFromHex(privateKeyHex string) (*btcec.PrivateKey, error)

GetPrivateKeyFromHex parses a hex-encoded private key string.

func ListKeys

func ListKeys(keystoreDir string)

ListKeys prints all accounts in the keystore directory to stdout.

func ZeroECDSAKey added in v0.26.0

func ZeroECDSAKey(key *ecdsa.PrivateKey)

ZeroECDSAKey overwrites the backing memory of an ECDSA private key's D value. Unlike big.Int.SetInt64(0) which only changes the logical value, this zeros the actual backing array to prevent key material from lingering in memory.

func ZeroPrivateKey added in v0.26.0

func ZeroPrivateKey(key *btcec.PrivateKey)

ZeroPrivateKey overwrites the private key bytes with zeros.

Types

type Dump

type Dump struct {
	PrivateKey, PublicKeyCompressed, PublicKey string
}

Dump holds hex-encoded representations of a key pair.

func EncodeHex

func EncodeHex(sk *btcec.PrivateKey, pk *btcec.PublicKey) *Dump

EncodeHex serializes a private/public key pair into hex-encoded strings.

Directories

Path Synopsis
Package hd provides basic functionality Hierarchical Deterministic Wallets.
Package hd provides basic functionality Hierarchical Deterministic Wallets.

Jump to

Keyboard shortcuts

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