keypair

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package keypair responses for account's private/public crypto keys.

Index

Constants

View Source
const (
	// AddressBytes stores the address length in bytes
	AddressBytes = 25
	// AddressLength stores the address length as string representation
	AddressLength = 40
	// PrettyAddressLength stores the address length as pretty string representation
	PrettyAddressLength = 46
)
View Source
const (
	// PrivateBytes stores the private key length in bytes
	PrivateBytes = 32
	// PublicBytes stores the public key length in bytes
	PublicBytes = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address [AddressBytes]byte

Address is a readable string representation for a public key.

func ParseAddress added in v0.3.0

func ParseAddress(str string) (Address, error)

ParseAddress constructs an instance of `Address` from given base32 string representation

func (Address) PrettyString

func (addr Address) PrettyString() string

PrettyString returns pretty formatted address with separators ('-').

func (Address) String

func (addr Address) String() string

type KeyPair

type KeyPair struct {
	Private []byte
	Public  []byte
}

KeyPair is a private/public crypto key pair.

func FromSeed added in v0.3.0

func FromSeed(seed []byte) (KeyPair, error)

FromSeed generates a new private/public key pair using specified private key

func Gen

func Gen() KeyPair

Gen generates a new private/public key pair using entropy from crypto rand.

func (KeyPair) Address

func (pair KeyPair) Address(chain core.Chain) Address

Address converts a key pair into corresponding address string representation.

Jump to

Keyboard shortcuts

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