Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptData(cipherdata, passphrase, iv []byte) ([]byte, error)
- func EncryptData(data, passphrase []byte) ([]byte, []byte, error)
- func GenerateKeyPairFromMnemonic(mnemonic string, hdPath string) (string, string, error)
- type Account
- type AccountNotFound
- type BaseHDWallet
- type BaseWallet
- func (w *BaseWallet) Close()
- func (w *BaseWallet) Create(name, passphrase, pubKeyStr, privKeyStr string) error
- func (w *BaseWallet) GenerateNewKey() (string, string, error)
- func (w *BaseWallet) GetUnlockedAccount(name string) (*PrivAccount, bool)
- func (w *BaseWallet) Info(name string) string
- func (w *BaseWallet) IsExist(name string) bool
- func (w *BaseWallet) IsLocked(name string) bool
- func (w *BaseWallet) List() []string
- func (w *BaseWallet) Load(name string) error
- func (w *BaseWallet) LoadAll() error
- func (w *BaseWallet) Lock(name string) error
- func (w *BaseWallet) Name() string
- func (w *BaseWallet) Path() string
- func (w *BaseWallet) Start() error
- func (w *BaseWallet) Unlock(name, passphrase string) error
- type DerivationPath
- type EncryptAccount
- type HDWallet
- type PrivAccount
- type ReentrantUnlockedAccountError
- type UnknownLockedAccountError
- type UnmatchedPassphraseError
- type Wallet
Constants ¶
View Source
const ( PasswordLength int = 32 ExpirationSeconds int64 = 5 * 60 * 60 * 24 * 30 )
Variables ¶
View Source
var DefaultRootDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 3077, 0x80000000 + 0, 0, 0}
Functions ¶
func DecryptData ¶
Types ¶
type AccountNotFound ¶
type AccountNotFound struct {
LocalName string
}
func (AccountNotFound) Error ¶
func (e AccountNotFound) Error() string
type BaseHDWallet ¶ added in v1.0.2
type BaseHDWallet struct { BaseWallet // contains filtered or unexported fields }
func NewBaseHDWallet ¶ added in v1.0.2
func NewBaseHDWallet(name string, path string) *BaseHDWallet
func (*BaseHDWallet) GenerateFromMnemonic ¶ added in v1.0.2
func (w *BaseHDWallet) GenerateFromMnemonic(mnemonic string) (string, string, error)
func (*BaseHDWallet) GenerateNewMnemonic ¶ added in v1.0.2
func (w *BaseHDWallet) GenerateNewMnemonic() (string, error)
type BaseWallet ¶
type BaseWallet struct {
// contains filtered or unexported fields
}
func NewBaseWallet ¶
func NewBaseWallet(name string, path string) *BaseWallet
func (*BaseWallet) Close ¶
func (w *BaseWallet) Close()
func (*BaseWallet) Create ¶
func (w *BaseWallet) Create(name, passphrase, pubKeyStr, privKeyStr string) error
func (*BaseWallet) GenerateNewKey ¶
func (w *BaseWallet) GenerateNewKey() (string, string, error)
func (*BaseWallet) GetUnlockedAccount ¶
func (w *BaseWallet) GetUnlockedAccount(name string) (*PrivAccount, bool)
func (*BaseWallet) Info ¶
func (w *BaseWallet) Info(name string) string
func (*BaseWallet) IsExist ¶
func (w *BaseWallet) IsExist(name string) bool
func (*BaseWallet) IsLocked ¶
func (w *BaseWallet) IsLocked(name string) bool
func (*BaseWallet) List ¶
func (w *BaseWallet) List() []string
func (*BaseWallet) Load ¶
func (w *BaseWallet) Load(name string) error
name should not be a path todo: check name
func (*BaseWallet) LoadAll ¶
func (w *BaseWallet) LoadAll() error
func (*BaseWallet) Lock ¶
func (w *BaseWallet) Lock(name string) error
w.locked hold all EncryptAccount and never modifies its content except add new account when unlock, a account being decrypted and added into unlock map
func (*BaseWallet) Name ¶
func (w *BaseWallet) Name() string
func (*BaseWallet) Path ¶
func (w *BaseWallet) Path() string
func (*BaseWallet) Start ¶
func (w *BaseWallet) Start() error
func (*BaseWallet) Unlock ¶
func (w *BaseWallet) Unlock(name, passphrase string) error
type DerivationPath ¶ added in v1.0.2
type DerivationPath []uint32
func ParseDerivationPath ¶ added in v1.0.2
func ParseDerivationPath(path string) (DerivationPath, error)
func (DerivationPath) String ¶ added in v1.0.2
func (path DerivationPath) String() string
String implements the stringer interface, converting a binary derivation path to its canonical representation.
type EncryptAccount ¶
type PrivAccount ¶
type ReentrantUnlockedAccountError ¶
type ReentrantUnlockedAccountError struct {
Name string
}
func (*ReentrantUnlockedAccountError) Error ¶
func (e *ReentrantUnlockedAccountError) Error() string
type UnknownLockedAccountError ¶
type UnknownLockedAccountError struct {
Name string
}
func (*UnknownLockedAccountError) Error ¶
func (e *UnknownLockedAccountError) Error() string
type UnmatchedPassphraseError ¶
type UnmatchedPassphraseError struct { }
func (UnmatchedPassphraseError) Error ¶
func (e UnmatchedPassphraseError) Error() string
type Wallet ¶
type Wallet interface { Name() string Path() string GenerateNewKey() (string, string, error) // return pubKey, privKey, error Create(name, passphrase, pubKeyStr, privKeyStr string) error GetUnlockedAccount(name string) (*PrivAccount, bool) Load(name string) error Lock(name string) error Unlock(name, passphrase string) error List() []string Info(name string) string Close() IsLocked(name string) bool IsExist(name string) bool }
Click to show internal directories.
Click to hide internal directories.