prysm-pulse/validator/accounts/v2/iface/wallet.go
Raul Jordan 7c52ef8c2b
Accounts V2: Simplify Wallet Save/Read To and From Disk Functions (#6686)
* simplify wallet functions

* fix build

* futher simplify wallet

* simplify read/write methods

* move direct functions to direct keymanager

* further move direct km specific funcs

* cleanup

* simplify the direct tests

* fixed tests

* lint

* further simplify

* tidy

* fix config write

* fixed test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-07-22 21:12:51 -05:00

24 lines
1.0 KiB
Go

package iface
import (
"context"
"io"
)
// Wallet defines a struct which has capabilities and knowledge of how
// to read and write important accounts-related files to the filesystem.
// Useful for keymanagers to have persistent capabilities for accounts on-disk.
type Wallet interface {
// Methods to retrieve wallet and accounts metadata.
AccountsDir() string
ListDirs() ([]string, error)
// Read methods for important wallet and accounts-related files.
ReadEncryptedSeedFromDisk(ctx context.Context) (io.ReadCloser, error)
ReadFileAtPath(ctx context.Context, filePath string, fileName string) ([]byte, error)
ReadPasswordFromDisk(ctx context.Context, passwordFileName string) (string, error)
// Write methods to persist important wallet and accounts-related files to disk.
WriteFileAtPath(ctx context.Context, pathName string, fileName string, data []byte) error
WritePasswordToDisk(ctx context.Context, passwordFileName string, password string) error
WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) error
}