wallet

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const KeyStoreScheme = "keystore"
View Source
const (
	PriKeyLen = 32
)
View Source
const TestKeyStoreScheme = "test_keystore"

Variables

This section is empty.

Functions

func AddrToPub added in v1.2.2

func AddrToPub(a *common.Address) (*bls.PublicKey, error)

func BalanceEth

func BalanceEth(balance float64) *big.Int

func BalanceHuman

func BalanceHuman(balance *big.Int) float64

func GeneratePriKey

func GeneratePriKey() *bls.SecretKey

func InitConfig

func InitConfig(c *Config)

func PubKeyToAddr added in v1.2.2

func PubKeyToAddr(p *bls.PublicKey) (addr common.Address, err error)

func VerifyByte

func VerifyByte(sig *bls.Sign, pub *bls.PublicKey, msg []byte) bool

Types

type Config

type Config struct {
	Dir string `json:"keystore"`
}

func DefaultConfig

func DefaultConfig(isMain bool, base string) *Config

func (Config) String

func (c Config) String() string

type Key

type Key struct {
	ID      uuid.UUID
	Light   bool
	Address common.Address
	// contains filtered or unexported fields
}

func DecryptKey

func DecryptKey(keyJson []byte, auth string) (*Key, error)

func LoadKeyFromJsonStr

func LoadKeyFromJsonStr(str, auth string) (*Key, error)

func NewKey

func NewKey() *Key

func NewLightKey

func NewLightKey(light bool) *Key

func (*Key) Addr added in v1.2.2

func (k *Key) Addr() string

func (*Key) CastEd25519Key

func (k *Key) CastEd25519Key() (crypto.PrivKey, error)

func (*Key) CastEthKey added in v1.2.2

func (k *Key) CastEthKey() (*ecdsa.PrivateKey, error)

func (*Key) Encrypt

func (k *Key) Encrypt(auth string) ([]byte, error)

func (*Key) GetPrivate added in v1.2.2

func (k *Key) GetPrivate() []byte

func (*Key) IDStr added in v1.2.2

func (k *Key) IDStr() string

func (*Key) IsOpen

func (k *Key) IsOpen() bool

func (*Key) PriLen added in v1.2.2

func (k *Key) PriLen() int

func (*Key) SharedKey

func (k *Key) SharedKey(to string) ([]byte, error)

func (*Key) SignData

func (k *Key) SignData(msg []byte) []byte

func (*Key) StoreString

func (k *Key) StoreString(auth string) string

type KeyStore

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

func NewKeyStore

func NewKeyStore(dir string) *KeyStore

func NewLightKeyStore

func NewLightKeyStore(dir string, isLight bool) *KeyStore

func (KeyStore) GetKey

func (ks KeyStore) GetKey(addr common.Address, filename, auth string) (*Key, error)

func (KeyStore) GetRawKey

func (ks KeyStore) GetRawKey(filename, auth string) (*Key, error)

func (KeyStore) IsKeyFile

func (ks KeyStore) IsKeyFile(filename string) (string, bool)

func (KeyStore) StoreKey

func (ks KeyStore) StoreKey(key *Key, auth string) error

func (KeyStore) ValidKeyFiles

func (ks KeyStore) ValidKeyFiles() (map[string]string, error)

type NinjaWallet

type NinjaWallet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*NinjaWallet) Active

func (c *NinjaWallet) Active(password, addr string) error

func (*NinjaWallet) AllAddrSaved added in v1.2.2

func (c *NinjaWallet) AllAddrSaved() []string

func (*NinjaWallet) CreateNewKey

func (c *NinjaWallet) CreateNewKey(auth string) error

func (*NinjaWallet) KeyInUsed

func (c *NinjaWallet) KeyInUsed() *Key

type Wallet

type Wallet interface {
	Active(password, selectAddr string) error
	KeyInUsed() *Key
	CreateNewKey(auth string) error
	AllAddrSaved() []string
}

func Inst

func Inst() Wallet

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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