entropystore

package
v0.0.3-powserver Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: GPL-3.0 Imports: 19 Imported by: 13

Documentation

Index

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 DecryptEntropy

func DecryptEntropy(entropyJson []byte, password string) ([]byte, error)

func EncryptEntropy

func EncryptEntropy(seed []byte, addr types.Address, password string) ([]byte, error)

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 FullKeyFileName

func FullKeyFileName(keysDirPath string, keyAddr types.Address) string

func IsMayValidEntropystoreFile

func IsMayValidEntropystoreFile(path string) (bool, *types.Address, error)

it it return false it must not be a valid seedstore file if it return a true it only means that might be true

func MnemonicToPrimaryAddr

func MnemonicToPrimaryAddr(mnemonic string) (primaryAddress *types.Address, e error)

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

func (ks CryptoStore) StoreEntropy(entropy []byte, primaryAddr types.Address, password string) error

type Manager

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

func NewManager

func NewManager(entropyStoreFilename string, primaryAddr types.Address, maxSearchIndex uint32) *Manager

func StoreNewEntropy

func StoreNewEntropy(storeDir string, mnemonic string, pwd string, maxSearchIndex uint32) (*Manager, error)

func (*Manager) DeriveForFullPath

func (km *Manager) DeriveForFullPath(path string) (fpath string, key *derivation.Key, err error)

func (*Manager) DeriveForFullPathWithPassphrase

func (km *Manager) DeriveForFullPathWithPassphrase(path, passphrase string) (fpath string, key *derivation.Key, err error)

func (*Manager) DeriveForIndexPath

func (km *Manager) DeriveForIndexPath(index uint32) (path string, key *derivation.Key, err error)

func (*Manager) DeriveForIndexPathWithPassphrase

func (km *Manager) DeriveForIndexPathWithPassphrase(index uint32, passphrase string) (path string, key *derivation.Key, err error)

func (*Manager) FindAddr

func (km *Manager) FindAddr(addr types.Address) (key *derivation.Key, index uint32, e error)

func (*Manager) FindAddrWithPassword

func (km *Manager) FindAddrWithPassword(password string, addr types.Address) (key *derivation.Key, index uint32, e error)

func (Manager) GetEntropyStoreFile

func (km Manager) GetEntropyStoreFile() string

func (Manager) GetPrimaryAddr

func (km Manager) GetPrimaryAddr() (primaryAddr types.Address)

func (*Manager) IsAddrUnlocked

func (km *Manager) IsAddrUnlocked(addr types.Address) bool

func (*Manager) IsUnlocked

func (km *Manager) IsUnlocked() bool

func (*Manager) ListAddress

func (km *Manager) ListAddress(from, to uint32) ([]types.Address, error)

func (*Manager) Lock

func (km *Manager) Lock()

func (*Manager) RemoveUnlockChangeChannel

func (km *Manager) RemoveUnlockChangeChannel()

func (*Manager) SetLockEventListener

func (km *Manager) SetLockEventListener(lis func(event UnlockEvent))

func (*Manager) SignData

func (km *Manager) SignData(a types.Address, data []byte) (signedData, pubkey []byte, err error)

func (*Manager) SignDataWithPassphrase

func (km *Manager) SignDataWithPassphrase(addr types.Address, passphrase string, data []byte) (signedData, pubkey []byte, err error)

func (*Manager) Unlock

func (km *Manager) Unlock(password string) error

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

Jump to

Keyboard shortcuts

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