wallet

package
v0.0.0-...-3b62c27 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Version1 byte = 0x00

Version1 is address version 1

Variables

This section is empty.

Functions

func ValidAddress

func ValidAddress(address string) bool

ValidAddress will return true if the address given is a valid wallet address

Types

type Wallet

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

Wallet is a digital wallet containing a public key and private key

func FromKey

func FromKey(priv *ecdsa.PrivateKey) *Wallet

FromKey will create a wallet from an ecdsa private key

func New

func New() *Wallet

New creates a new wallet with the default version.

func Versioned

func Versioned(v byte) *Wallet

Versioned will create a new wallet with a given version number.

func (*Wallet) Address

func (w *Wallet) Address() string

Address will create a wallet address from the wallet's public key.

func (*Wallet) Bytes

func (w *Wallet) Bytes() ([]byte, error)

Bytes get gets the raw bytes of the key

func (*Wallet) Equals

func (w *Wallet) Equals(k crypto.Key) bool

Equals returns true if the key pass is the same key

func (*Wallet) GetPublic

func (w *Wallet) GetPublic() crypto.PubKey

GetPublic gets the public key

func (*Wallet) PrivateKey

func (w *Wallet) PrivateKey() *ecdsa.PrivateKey

PrivateKey returns the wallet's private key

func (*Wallet) PubKeyHash

func (w *Wallet) PubKeyHash() []byte

PubKeyHash will generate the hash for the wallet's public key

func (*Wallet) PublicKey

func (w *Wallet) PublicKey() []byte

PublicKey return's the wallet's public key

func (*Wallet) Raw

func (w *Wallet) Raw() ([]byte, error)

Raw gets the raw data

func (*Wallet) ReadFrom

func (w *Wallet) ReadFrom(r io.Reader) (int64, error)

ReadFrom will populate the wallet data by reading from an io.Reader

func (*Wallet) Sign

func (w *Wallet) Sign(b []byte) ([]byte, error)

Sign will sign a byte array with the private key

func (*Wallet) Type

func (w *Wallet) Type() crypto_pb.KeyType

Type returns the type of key that the wallet has

func (*Wallet) WriteTo

func (w *Wallet) WriteTo(wr io.Writer) (int64, error)

WriteTo will serialize the wallet and write it to an io.Writer

Jump to

Keyboard shortcuts

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