Versions in this module Expand all Collapse all v0 v0.0.1 Jun 20, 2023 Changes in this version + const KeyStoreScheme + const LightScryptN + const LightScryptP + const StandardScryptN + const StandardScryptP + var ErrAccountAlreadyExists = errors.New("account already exists") + var ErrDecrypt = errors.New("could not decrypt key with given passphrase") + var ErrInvalidPassphrase = errors.New("invalid passphrase") + var ErrLocked = NewAuthNeededError("password or unlock") + var ErrNoMatch = errors.New("no key for given address or file") + var ErrNotSupported = errors.New("not supported") + var ErrUnknownAccount = errors.New("unknown account") + var ErrUnknownWallet = errors.New("unknown wallet") + var ErrWalletAlreadyOpen = errors.New("wallet already open") + var ErrWalletClosed = errors.New("wallet closed") + var KeyStoreType = reflect.TypeOf(&KeyStore{}) + func DecryptDataV3(cj CryptoJSON, auth string) ([]byte, error) + func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) + func NewAuthNeededError(needed string) error + func RecoverPubkey(hash []byte, signature []byte) (address.Address, error) + func TextAndHash(data []byte, useFixedLength ...bool) ([]byte, string) + func TextHash(data []byte, useFixedLength ...bool) []byte + func UnmarshalPublic(pbk []byte) (*ecdsa.PublicKey, error) + type Account struct + Address address.Address + URL URL + func StoreKey(dir, auth string, scryptN, scryptP int) (Account, error) + type AmbiguousAddrError struct + Addr address.Address + Matches []Account + func (err *AmbiguousAddrError) Error() string + type AuthNeededError struct + Needed string + func (err *AuthNeededError) Error() string + type CryptoJSON struct + Cipher string + CipherParams cipherparamsJSON + CipherText string + KDF string + KDFParams map[string]interface{} + MAC string + func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error) + type DerivationPath []uint32 + type Key struct + Address address.Address + ID uuid.UUID + PrivateKey *ecdsa.PrivateKey + func DecryptKey(keyjson []byte, auth string) (*Key, error) + func NewKeyForDirectICAP(rand io.Reader) *Key + func (k *Key) MarshalJSON() (j []byte, err error) + func (k *Key) UnmarshalJSON(j []byte) (err error) + type KeyStore struct + func ForPath(p string) *KeyStore + func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore + func (ks *KeyStore) Accounts() []Account + func (ks *KeyStore) Delete(a Account, passphrase string) error + func (ks *KeyStore) Export(a Account, passphrase, newPassphrase string) (keyJSON []byte, err error) + func (ks *KeyStore) Find(a Account) (Account, error) + func (ks *KeyStore) GetDecryptedKey(a Account, auth string) (Account, *Key, error) + func (ks *KeyStore) HasAddress(addr address.Address) bool + func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (Account, error) + func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (Account, error) + func (ks *KeyStore) Lock(addr address.Address) error + func (ks *KeyStore) NewAccount(passphrase string) (Account, error) + func (ks *KeyStore) SignHash(a Account, hash []byte) ([]byte, error) + func (ks *KeyStore) SignHashWithPassphrase(a Account, passphrase string, hash []byte) (signature []byte, err error) + func (ks *KeyStore) SignTx(a Account, tx *core.Transaction) (*core.Transaction, error) + func (ks *KeyStore) SignTxWithPassphrase(a Account, passphrase string, tx *core.Transaction) (*core.Transaction, error) + func (ks *KeyStore) Subscribe(sink chan<- WalletEvent) event.Subscription + func (ks *KeyStore) TimedUnlock(a Account, passphrase string, timeout time.Duration) error + func (ks *KeyStore) Unlock(a Account, passphrase string) error + func (ks *KeyStore) Update(a Account, passphrase, newPassphrase string) error + func (ks *KeyStore) Wallets() []Wallet + type URL struct + Path string + Scheme string + func (u *URL) UnmarshalJSON(input []byte) error + func (u URL) Cmp(url URL) int + func (u URL) MarshalJSON() ([]byte, error) + func (u URL) String() string + func (u URL) TerminalString() string + type Wallet interface + Accounts func() []Account + Close func() error + Contains func(account Account) bool + Derive func(path DerivationPath, pin bool) (Account, error) + Open func(passphrase string) error + SignData func(account Account, mimeType string, data []byte) ([]byte, error) + SignDataWithPassphrase func(account Account, passphrase, mimeType string, data []byte) ([]byte, error) + SignText func(account Account, text []byte, useFixedLength ...bool) ([]byte, error) + SignTextWithPassphrase func(account Account, passphrase string, hash []byte) ([]byte, error) + SignTx func(account Account, tx *core.Transaction) (*core.Transaction, error) + SignTxWithPassphrase func(account Account, passphrase string, tx *core.Transaction) (*core.Transaction, error) + Status func() (string, error) + URL func() URL + type WalletEvent struct + Kind WalletEventType + Wallet Wallet + type WalletEventType int + const WalletArrived + const WalletDropped + const WalletOpened