secp256k1

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: GPL-3.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const PrivateKeyLength = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Keypair

type Keypair struct {
	// contains filtered or unexported fields
}

func GenerateKeypair

func GenerateKeypair() (*Keypair, error)

func NewKeypair

func NewKeypair(pk ecdsa.PrivateKey) *Keypair

func NewKeypairFromPrivateKey

func NewKeypairFromPrivateKey(priv []byte) (*Keypair, error)

func NewKeypairFromString

func NewKeypairFromString(priv string) (*Keypair, error)

NewKeypairFromPrivateKey parses a string for a hex private key. Must be at least PrivateKeyLength long.

func (*Keypair) Address

func (kp *Keypair) Address() string

Address returns the Ethereum address format

func (*Keypair) CommonAddress

func (kp *Keypair) CommonAddress() common.Address

CommonAddress returns the Ethereum address in the common.Address Format

func (*Keypair) Decode

func (kp *Keypair) Decode(in []byte) error

Decode initializes the keypair using the input

func (*Keypair) Encode

func (kp *Keypair) Encode() []byte

Encode dumps the private key as bytes

func (*Keypair) PrivateKey

func (kp *Keypair) PrivateKey() *ecdsa.PrivateKey

PrivateKey returns the keypair's private key

func (*Keypair) PublicKey

func (kp *Keypair) PublicKey() string

PublicKey returns the public key hex encoded

func (*Keypair) PublicKeyBytes

func (kp *Keypair) PublicKeyBytes() []byte

Jump to

Keyboard shortcuts

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