entropystore

package
v0.0.3-mobile Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: GPL-3.0 Imports: 21 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

	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptN = 1 << 12

	// LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptP = 6
)
View Source
const (
	Locked   = "Locked"
	UnLocked = "Unlocked"

	DefaultMaxIndex = uint32(100)
)

Variables

This section is empty.

Functions

func EncryptEntropy

func EncryptEntropy(entropy EntropyProfile, passphrase string, useLightScrypt bool) ([]byte, error)

func FindAddrFromEntropy

func FindAddrFromEntropy(entropy EntropyProfile, addr types.Address, extensionWord *string, maxSearchIndex uint32) (key *derivation.Key, index uint32, e error)

func FullKeyFileName

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

func NewMnemonic

func NewMnemonic(language string, mnemonicSize *int) (string, error)

Types

type Config

type Config struct {
	MaxSearchIndex uint32
	UseLightScrypt bool
}

type CryptoStore

type CryptoStore struct {
	EntropyStoreFilename string
	UseLightScrypt       bool
}

func NewCryptoStore

func NewCryptoStore(entropyStoreFilename string, useLightScrypt bool) *CryptoStore

func (CryptoStore) ExtractEntropy

func (ks CryptoStore) ExtractEntropy(passphrase string) (*EntropyProfile, error)

func (CryptoStore) StoreEntropy

func (ks CryptoStore) StoreEntropy(entropy EntropyProfile, passphrase string) error

type EntropyJSONV1

type EntropyJSONV1 struct {
	EntropyProfile
	Id        string     `json:"uuid"`
	Crypto    cryptoJSON `json:"crypto"`
	Version   int        `json:"version"`
	Timestamp int64      `json:"timestamp"`
}

func IsMayValidEntropystoreFile

func IsMayValidEntropystoreFile(path string) (bool, *EntropyJSONV1, 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

type EntropyProfile

type EntropyProfile struct {
	Entropy []byte `json:"-"`

	MnemonicLang        string         `json:"mnemonicLang"`
	UseTwoFactorPhrases bool           `json:"useTwoFactorPhrases"`
	PrimaryAddress      *types.Address `json:"primaryAddress"`
	// contains filtered or unexported fields
}

func DecryptEntropy

func DecryptEntropy(entropyJson []byte, passphrase string) (*EntropyProfile, error)

func MnemonicToEntropy

func MnemonicToEntropy(mnemonic, language string, useTwoFactorPhrases bool, extensionWord *string) (entropyprofile *EntropyProfile, e error)

func (*EntropyProfile) ExtractMnemonic

func (ep *EntropyProfile) ExtractMnemonic() (mnemonic string, err error)

func (*EntropyProfile) GetSeed

func (ep *EntropyProfile) GetSeed(extensionWord *string) (seed []byte, err error)

type Manager

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

func NewManager

func NewManager(entropyStoreFilename string, primaryAddr types.Address, config *Config) *Manager

func StoreNewEntropy

func StoreNewEntropy(storeDir, passphrase string, entropyprofile *EntropyProfile, config *Config) (*Manager, error)

func (*Manager) DeriveForFullPath

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

func (*Manager) DeriveForFullPathWithPassphrase

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

func (*Manager) DeriveForIndexPath

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

func (*Manager) DeriveForIndexPathWithPassphrase

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

func (*Manager) ExtractMnemonic

func (km *Manager) ExtractMnemonic(passphrase string) (string, error)

func (*Manager) FindAddr

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

func (*Manager) FindAddrWithPassphrase

func (km *Manager) FindAddrWithPassphrase(passphrase string, addr types.Address, extensionWord *string) (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, extensionWord *string) bool

func (*Manager) IsUnlocked

func (km *Manager) IsUnlocked() bool

func (*Manager) ListAddress

func (km *Manager) ListAddress(from, to uint32, extensionWord *string) ([]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, bip44index *uint32, extensionWord *string) (signedData, pubkey []byte, err error)

func (*Manager) SignDataWithPassphrase

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

func (*Manager) Unlock

func (km *Manager) Unlock(passphrase 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