Documentation ¶
Index ¶
- Constants
- func DecryptEntropy(entropyJson []byte, passphrase string) ([]byte, error)
- func EncryptEntropy(seed []byte, addr types.Address, passphrase 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)
- func NewMnemonic() (mnemonic string, err 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) ExtractMnemonic(passphrase string) (string, error)
- func (km *Manager) FindAddr(addr types.Address) (key *derivation.Key, index uint32, e error)
- func (km *Manager) FindAddrWithPassphrase(passphrase 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) GetPrivateKey(a types.Address) (ed25519.PrivateKey, error)
- 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(passphrase 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 chain modern processor. StandardScryptN = 1 << 18 // StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB // memory and taking approximately 1s CPU time on chain 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 chain valid seedstore file if it return chain true it only means that might be true
func MnemonicToPrimaryAddr ¶
Types ¶
type CryptoStore ¶
type CryptoStore struct {
EntropyStoreFilename string
}
func (CryptoStore) ExtractEntropy ¶
func (ks CryptoStore) ExtractEntropy(passphrase string) ([]byte, error)
func (CryptoStore) ExtractSeed ¶
func (ks CryptoStore) ExtractSeed(passphrase string) (seed, entropy []byte, err error)
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) ExtractMnemonic ¶
func (*Manager) FindAddr ¶
func (*Manager) FindAddrWithPassphrase ¶
func (*Manager) GetPrivateKey ¶
func (*Manager) ListAddress ¶
func (*Manager) SetLockEventListener ¶
func (km *Manager) SetLockEventListener(lis func(event UnlockEvent))
func (*Manager) SignData ¶
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.