secp256k1

package
v1.0.42 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: LGPL-3.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Jump to

Keyboard shortcuts

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