component

package
v0.0.0-...-7505a0c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPERMISSION = iota //read
	WPERMISSION        //write
)
View Source
const (
	LOCKED   = iota //locked
	UNLOCKED        //unlocked
)

Variables

This section is empty.

Functions

func NewAccountCache

func NewAccountCache(keyStoreDir string, password string) (*accountCache, error)

NewAccountCache receive an path and password as argument path refer to the file that contain all key password used to decrypto content in key file

Types

type CryptedNode

type CryptedNode struct {
	CryptoPrivateKey []byte                `json:"cryptoPrivateKey"`
	PrivateKey       *secp256k1.PrivateKey `json:"-"`
	ChainId          common.ChainIdType    `json:"chainId"`
	ChainCode        []byte                `json:"chainCode"`

	Key []byte `json:"-"`
	Iv  []byte `json:"iv"`
}

func (*CryptedNode) DeCrypt

func (cryptedNode *CryptedNode) DeCrypt() *accountTypes.Node

func (*CryptedNode) EnCrypt

func (cryptedNode *CryptedNode) EnCrypt()

type DbStore

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

DbStore use leveldb as the storegae

func NewDbStore

func NewDbStore(dbStoreDir string) DbStore

func (*DbStore) ExportKey

func (dbStore *DbStore) ExportKey(auth string) ([]*accountTypes.Node, error)

ExportKey export all key in db by password

func (*DbStore) GetKey

func (db *DbStore) GetKey(addr crypto.CommonAddress, auth string) (*accountTypes.Node, error)

GetKey read key in db

func (*DbStore) JoinPath

func (dbStore *DbStore) JoinPath(filename string) string

JoinPath return the db file path

func (*DbStore) StoreKey

func (dbStore *DbStore) StoreKey(key *accountTypes.Node, auth string) error

store the key in db after encrypto

type FileStore

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

func NewFileStore

func NewFileStore(keyStoreDir string) FileStore

func (FileStore) ExportKey

func (fs FileStore) ExportKey(auth string) ([]*accountTypes.Node, error)

ExportKey export all key in file by password

func (FileStore) GetKey

func (fs FileStore) GetKey(addr *crypto.CommonAddress, auth string) (*accountTypes.Node, error)

GetKey read key in file

func (FileStore) JoinPath

func (fs FileStore) JoinPath(filename string) string

JoinPath return keystore directory

func (FileStore) StoreKey

func (fs FileStore) StoreKey(key *accountTypes.Node, auth string) error

store the key in file encrypto

type Wallet

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

func NewWallet

func NewWallet(config *accountTypes.Config, chainId common.ChainIdType) (*Wallet, error)

func (*Wallet) Close

func (wallet *Wallet) Close()

func (*Wallet) DumpPrivateKey

func (wallet *Wallet) DumpPrivateKey(addr *crypto.CommonAddress) (*secp256k1.PrivateKey, error)

func (*Wallet) GetAccountByAddress

func (wallet *Wallet) GetAccountByAddress(addr *crypto.CommonAddress) (*accountTypes.Node, error)

func (*Wallet) GetAccountByPubkey

func (wallet *Wallet) GetAccountByPubkey(pubkey *secp256k1.PublicKey) (*accountTypes.Node, error)

func (*Wallet) IsLock

func (wallet *Wallet) IsLock() bool

0 is locked 1 is unlock

func (*Wallet) IsOpen

func (wallet *Wallet) IsOpen() bool

func (*Wallet) ListAddress

func (wallet *Wallet) ListAddress() ([]*crypto.CommonAddress, error)

func (*Wallet) Lock

func (wallet *Wallet) Lock() error

func (*Wallet) NewAccount

func (wallet *Wallet) NewAccount() (*accountTypes.Node, error)

func (*Wallet) Open

func (wallet *Wallet) Open(password string) error

func (*Wallet) UnLock

func (wallet *Wallet) UnLock(password string) error

Jump to

Keyboard shortcuts

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