wallet_plugin

package
v0.0.0-...-c626c17 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const WalletPlug = PluginTypeName("WalletPlugin")

Variables

View Source
var (
	ErrWalletLocked          = errors.New("Unable to handle a locked wallet")
	ErrWalletNoPassword      = errors.New("No password")
	ErrWallerInvalidPassword = errors.New("Invalid password for wallet")
	ErrWalletKeyExist        = errors.New("Key already in wallet")
)
View Source
var (
	ErrWalletNotAvaliable = errors.New("You don't have any wallet")
	ErrWalletNotUnlocked  = errors.New("You don't have any unlocked wallet!")
)
View Source
var DefaultWalletFilename = ""

Functions

func Decrypt

func Decrypt(keystr string, src []byte) (strDesc []byte, err error)

func Encrypt

func Encrypt(keystr string, strMsg string) ([]byte, error)

Types

type BaseWalletApi

type BaseWalletApi interface {
	GetPrivateKey(pubkey ecc.PublicKey) ecc.PrivateKey

	IsLocked() bool
	Lock()
	Unlock(password string)

	CheckPassword(password string)
	SetPassword(password string)

	ListKeys() map[ecc.PublicKey]ecc.PrivateKey
	ListPublicKeys() []ecc.PublicKey

	ImportKey(wifKey string) bool
	RemoveKey(key string) bool
	CreateKey(keyType string) string

	TrySignDigest(digest []byte, publicKey ecc.PublicKey) *ecc.Signature
}

type CKeys

type CKeys []byte

func (CKeys) MarshalJSON

func (w CKeys) MarshalJSON() ([]byte, error)

func (*CKeys) UnmarshalJSON

func (w *CKeys) UnmarshalJSON(data []byte) (err error)

type CreateKeyParams

type CreateKeyParams struct {
	Name    string `json:"name"`
	KeyType string `json:"keytype"`
}

type ImportKeyParams

type ImportKeyParams struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

type KeyMapType

type KeyMapType = map[ecc.PublicKey]uint16

type ListKeysParams

type ListKeysParams struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

type PlainKeys

type PlainKeys struct {
	CheckSum []byte
	Keys     map[ecc.PublicKey]ecc.PrivateKey
}

type RemoveKeyParams

type RemoveKeyParams struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	Key      string `json:"key"`
}

type RespKeys

type RespKeys map[ecc.PublicKey]ecc.PrivateKey

func (RespKeys) MarshalJSON

func (k RespKeys) MarshalJSON() ([]byte, error)

func (*RespKeys) UnmarshalJSON

func (k *RespKeys) UnmarshalJSON(v []byte) (err error)

type SignTrxParams

type SignTrxParams struct {
	Txn     *types.SignedTransaction `json:"signed_transaction"`
	Keys    []ecc.PublicKey          `json:"keys"`
	ChainID common.ChainIdType       `json:"id"`
}

type SoftWallet

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

func (*SoftWallet) CheckPassword

func (w *SoftWallet) CheckPassword(password string)

func (*SoftWallet) CopyWalletFile

func (w *SoftWallet) CopyWalletFile(destinationFilename string) bool

func (*SoftWallet) CreateKey

func (w *SoftWallet) CreateKey(keyType string) string

func (*SoftWallet) EncryptKeys

func (w *SoftWallet) EncryptKeys()

func (*SoftWallet) GetPrivateKey

func (w *SoftWallet) GetPrivateKey(pubkey ecc.PublicKey) ecc.PrivateKey

func (*SoftWallet) GetPrivateKeyFromPassword

func (w *SoftWallet) GetPrivateKeyFromPassword(account string, role string, password string) common.Pair

func (*SoftWallet) GetWalletFilename

func (w *SoftWallet) GetWalletFilename() string

func (*SoftWallet) ImportKey

func (w *SoftWallet) ImportKey(wifKey string) bool

func (*SoftWallet) IsLocked

func (w *SoftWallet) IsLocked() bool

func (*SoftWallet) IsNew

func (w *SoftWallet) IsNew() bool

func (*SoftWallet) ListKeys

func (w *SoftWallet) ListKeys() map[ecc.PublicKey]ecc.PrivateKey

func (*SoftWallet) ListPublicKeys

func (w *SoftWallet) ListPublicKeys() generated.PublicKeySet

func (*SoftWallet) LoadWalletFile

func (w *SoftWallet) LoadWalletFile(walletFilename string) bool

func (*SoftWallet) Lock

func (w *SoftWallet) Lock()

func (*SoftWallet) RemoveKey

func (w *SoftWallet) RemoveKey(key string) bool

func (*SoftWallet) SaveWalletFile

func (w *SoftWallet) SaveWalletFile(walletFilename string)

func (*SoftWallet) SetPassword

func (w *SoftWallet) SetPassword(password string)

SetPassword Sets a new password on the wallet

func (*SoftWallet) SetWalletFilename

func (w *SoftWallet) SetWalletFilename(filename string)

func (*SoftWallet) TrySignDigest

func (w *SoftWallet) TrySignDigest(digest []byte, publicKey ecc.PublicKey) *ecc.Signature

func (*SoftWallet) Unlock

func (w *SoftWallet) Unlock(password string)

type SoftWalletImpl

type SoftWalletImpl struct {
	WalletFilename string
	Wallet         WalletData
	Keys           map[ecc.PublicKey]ecc.PrivateKey
	Checksum       []byte
}

func (*SoftWalletImpl) CopyWalletFile

func (w *SoftWalletImpl) CopyWalletFile(password string) bool

func (*SoftWalletImpl) CreateKey

func (w *SoftWalletImpl) CreateKey(keyType string) string

func (*SoftWalletImpl) EncryptKeys

func (w *SoftWalletImpl) EncryptKeys()

func (*SoftWalletImpl) GetPrivateKey

func (w *SoftWalletImpl) GetPrivateKey(pubkey ecc.PublicKey) ecc.PrivateKey

func (*SoftWalletImpl) GetWalletFilename

func (w *SoftWalletImpl) GetWalletFilename() string

func (*SoftWalletImpl) ImportKey

func (w *SoftWalletImpl) ImportKey(wifKey string) bool

func (*SoftWalletImpl) IsLocked

func (w *SoftWalletImpl) IsLocked() bool

func (*SoftWalletImpl) LoadWalletFile

func (w *SoftWalletImpl) LoadWalletFile(walletFilename string) bool

func (*SoftWalletImpl) RemoveKey

func (w *SoftWalletImpl) RemoveKey(key string) bool

func (*SoftWalletImpl) SaveWalletFile

func (w *SoftWalletImpl) SaveWalletFile(walletFilename string)

func (*SoftWalletImpl) TryGetPrivateKey

func (w *SoftWalletImpl) TryGetPrivateKey(id ecc.PublicKey) *ecc.PrivateKey

func (*SoftWalletImpl) TrySignDigest

func (w *SoftWalletImpl) TrySignDigest(digest []byte, publicKey ecc.PublicKey) *ecc.Signature

type Sprivate

type Sprivate struct {
	Curve   ecc.CurveID
	PrivKey []byte
}

type SprivateKeys

type SprivateKeys struct {
	CheckSum []byte
	Keys     map[ecc.PublicKey]Sprivate
}

type UnlockParams

type UnlockParams struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

type WalletData

type WalletData struct {
	CipherKeys CKeys `json:"cipher_keys"` /** encrypted keys */
}

type WalletManager

type WalletManager struct {
	Self *WalletPlugin

	Wallets map[string]*SoftWallet
	// contains filtered or unexported fields
}

func (*WalletManager) Create

func (wm *WalletManager) Create(name string) string

func (*WalletManager) CreateKey

func (wm *WalletManager) CreateKey(name, keyType string) string

func (*WalletManager) GetPublicKeys

func (wm *WalletManager) GetPublicKeys() (re []string)

func (*WalletManager) ImportKey

func (wm *WalletManager) ImportKey(name, wifkey string)

func (*WalletManager) ListKeys

func (wm *WalletManager) ListKeys(name, password string) RespKeys

func (*WalletManager) ListWallets

func (wm *WalletManager) ListWallets() []string

func (*WalletManager) Lock

func (wm *WalletManager) Lock(name string)

func (*WalletManager) LockAllwallets

func (wm *WalletManager) LockAllwallets()

func (*WalletManager) Open

func (wm *WalletManager) Open(name string)

func (*WalletManager) RemoveKey

func (wm *WalletManager) RemoveKey(name, password, key string)

func (*WalletManager) SetDir

func (wm *WalletManager) SetDir(path string)

func (*WalletManager) SetTimeOut

func (wm *WalletManager) SetTimeOut(t int64)

func (*WalletManager) SignDigest

func (wm *WalletManager) SignDigest(digest common.DigestType, key ecc.PublicKey) (sig ecc.Signature)

func (*WalletManager) SignTransaction

func (wm *WalletManager) SignTransaction(txn *types.SignedTransaction, keys []ecc.PublicKey, chainID common.ChainIdType) *types.SignedTransaction

func (*WalletManager) Unlock

func (wm *WalletManager) Unlock(name, password string)

type WalletPlugin

type WalletPlugin struct {
	AbstractPlugin
	// contains filtered or unexported fields
}

func NewWalletPlugin

func NewWalletPlugin(io *asio.IoContext) *WalletPlugin

func (*WalletPlugin) GetWalletManager

func (w *WalletPlugin) GetWalletManager() *WalletManager

func (*WalletPlugin) PluginInitialize

func (w *WalletPlugin) PluginInitialize(c *cli.Context)

func (*WalletPlugin) PluginShutdown

func (w *WalletPlugin) PluginShutdown()

func (*WalletPlugin) PluginStartup

func (w *WalletPlugin) PluginStartup()

func (*WalletPlugin) SetProgramOptions

func (w *WalletPlugin) SetProgramOptions(options *[]cli.Flag)

type YhCapabilities

type YhCapabilities struct {
}

type YhConnector

type YhConnector struct {
}

type YhSession

type YhSession struct {
}

type YubihsmApi

type YubihsmApi struct {
}

type YubihsmWallet

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

func (YubihsmWallet) GetPrivateKey

func (y YubihsmWallet) GetPrivateKey(pubkey ecc.PublicKey) ecc.PrivateKey

func (YubihsmWallet) IsLocked

func (y YubihsmWallet) IsLocked() bool

func (YubihsmWallet) Lock

func (y YubihsmWallet) Lock()

type YubihsmWalletImpl

type YubihsmWalletImpl struct {
	Connector      *YhConnector
	Session        *YhSession
	Endpoint       string
	AuthKey        uint16
	Keys           KeyMapType
	AuthKeyCaps    YhCapabilities
	AuthKeyDomains uint16
	Api            YubihsmApi
}

func (YubihsmWalletImpl) IsLocked

func (y YubihsmWalletImpl) IsLocked() bool

func (YubihsmWalletImpl) Lock

func (y YubihsmWalletImpl) Lock()

func (YubihsmWalletImpl) Unlock

func (y YubihsmWalletImpl) Unlock(password string)

Jump to

Keyboard shortcuts

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