Documentation ¶
Index ¶
Constants ¶
View Source
const AccountFileName = "accounts.db"
Variables ¶
View Source
var (
ErrInvalidPassword = errors.New("invalid password")
)
Functions ¶
func NewDerivationPath ¶
NewDerivationPath returns derivation path for given account index
Types ¶
type Account ¶
func NewAccount ¶
func NewAccount(idx uint64, key AccountKey) *Account
type AccountKey ¶
type AccountKey struct { PubKey []byte `json:"pubKey"` // compressed secp256k1 key 33 bytes PrivKey []byte `json:"privKey"` PubKeyHash *KeyHashes `json:"pubKeyHash"` DerivationPath []byte `json:"derivationPath"` }
func NewAccountKey ¶
func NewAccountKey(masterKey *hdkeychain.ExtendedKey, derivationPath string) (*AccountKey, error)
NewAccountKey generates new account key from given master key and derivation path
type KeyHashes ¶
type KeyHashes struct {
Sha256 []byte `json:"sha256"`
}
func NewKeyHash ¶
NewKeyHash creates sha256/sha512 hash pair from given key
type Keys ¶
type Keys struct { Mnemonic string MasterKey *hdkeychain.ExtendedKey AccountKey *AccountKey }
type Manager ¶
type Manager interface { GetAll() []Account CreateKeys(mnemonic string) error AddAccount() (uint64, []byte, error) GetMnemonic() (string, error) GetAccountKey(uint64) (*AccountKey, error) GetAccountKeys() ([]*AccountKey, error) GetMaxAccountIndex() (uint64, error) GetPublicKey(accountIndex uint64) ([]byte, error) GetPublicKeys() ([][]byte, error) Close() }
Manager manages accounts
type TxContext ¶
type TxContext interface { AddAccount(accountIndex uint64, key *AccountKey) error GetAccountKey(accountIndex uint64) (*AccountKey, error) GetAccountKeys() ([]*AccountKey, error) GetMaxAccountIndex() (uint64, error) SetMaxAccountIndex(accountIndex uint64) error GetMasterKey() (string, error) SetMasterKey(masterKey string) error GetMnemonic() (string, error) SetMnemonic(mnemonic string) error IsEncrypted() (bool, error) SetEncrypted(encrypted bool) error VerifyPassword() (bool, error) }
Click to show internal directories.
Click to hide internal directories.