Documentation ¶
Index ¶
- Constants
- func DecryptEntropy(entropyJson []byte, password string) ([]byte, error)
- func EncryptEntropy(seed []byte, addr types.Address, password string) ([]byte, error)
- func FindAddrFromSeed(seed []byte, addr types.Address, maxSearchIndex uint32) (key *derivation.Key, index uint32, e error)
- func FullKeyFileName(keysDirPath string, keyAddr types.Address) string
- func IsMayValidEntropystoreFile(path string) (bool, *types.Address, error)
- func MnemonicToPrimaryAddr(mnemonic string) (primaryAddress *types.Address, e error)
- type CryptoStore
- type Manager
- func (km *Manager) DeriveForFullPath(path string) (fpath string, key *derivation.Key, err error)
- func (km *Manager) DeriveForFullPathWithPassphrase(path, passphrase string) (fpath string, key *derivation.Key, err error)
- func (km *Manager) DeriveForIndexPath(index uint32) (path string, key *derivation.Key, err error)
- func (km *Manager) DeriveForIndexPathWithPassphrase(index uint32, passphrase string) (path string, key *derivation.Key, err error)
- func (km *Manager) FindAddr(addr types.Address) (key *derivation.Key, index uint32, e error)
- func (km *Manager) FindAddrWithPassword(password string, addr types.Address) (key *derivation.Key, index uint32, e error)
- func (km Manager) GetEntropyStoreFile() string
- func (km Manager) GetPrimaryAddr() (primaryAddr types.Address)
- func (km *Manager) IsAddrUnlocked(addr types.Address) bool
- func (km *Manager) IsUnlocked() bool
- func (km *Manager) ListAddress(from, to uint32) ([]types.Address, error)
- func (km *Manager) Lock()
- func (km *Manager) RemoveUnlockChangeChannel()
- func (km *Manager) SetLockEventListener(lis func(event UnlockEvent))
- func (km *Manager) SignData(a types.Address, data []byte) (signedData, pubkey []byte, err error)
- func (km *Manager) SignDataWithPassphrase(addr types.Address, passphrase string, data []byte) (signedData, pubkey []byte, err error)
- func (km *Manager) Unlock(password string) error
- type UnlockEvent
Constants ¶
View Source
const ( // StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB // memory and taking approximately 1s CPU time on a modern processor. StandardScryptN = 1 << 18 // StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB // memory and taking approximately 1s CPU time on a modern processor. StandardScryptP = 1 )
View Source
const ( Locked = "Locked" UnLocked = "Unlocked" DefaultMaxIndex = uint32(100) )
Variables ¶
This section is empty.
Functions ¶
func EncryptEntropy ¶
func FindAddrFromSeed ¶
func FindAddrFromSeed(seed []byte, addr types.Address, maxSearchIndex uint32) (key *derivation.Key, index uint32, e error)
it is very fast(in my mac 2.8GHZ intel cpu 10Ks search cost 728ms) so we dont need cache the relation
func IsMayValidEntropystoreFile ¶
it it return false it must not be a valid seedstore file if it return a true it only means that might be true
Types ¶
type CryptoStore ¶
type CryptoStore struct {
EntropyStoreFilename string
}
func (CryptoStore) ExtractEntropy ¶
func (ks CryptoStore) ExtractEntropy(password string) ([]byte, error)
func (CryptoStore) ExtractSeed ¶
func (ks CryptoStore) ExtractSeed(password string) (seed, entropy []byte, err error)
func (CryptoStore) StoreEntropy ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func StoreNewEntropy ¶
func (*Manager) DeriveForFullPath ¶
func (*Manager) DeriveForFullPathWithPassphrase ¶
func (*Manager) DeriveForIndexPath ¶
func (*Manager) DeriveForIndexPathWithPassphrase ¶
func (*Manager) FindAddrWithPassword ¶
func (Manager) GetEntropyStoreFile ¶
func (Manager) GetPrimaryAddr ¶
func (*Manager) IsUnlocked ¶
func (*Manager) ListAddress ¶
func (*Manager) RemoveUnlockChangeChannel ¶
func (km *Manager) RemoveUnlockChangeChannel()
func (*Manager) SetLockEventListener ¶
func (km *Manager) SetLockEventListener(lis func(event UnlockEvent))
func (*Manager) SignDataWithPassphrase ¶
type UnlockEvent ¶
type UnlockEvent struct { EntropyStoreFile string PrimaryAddr types.Address // represent which seed we use the seed`s PrimaryAddress represents the seed // contains filtered or unexported fields }
func (UnlockEvent) String ¶
func (ue UnlockEvent) String() string
func (UnlockEvent) Unlocked ¶
func (ue UnlockEvent) Unlocked() bool
Click to show internal directories.
Click to hide internal directories.