2020-07-21 02:05:23 +00:00
|
|
|
package iface
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
2020-09-09 18:29:17 +00:00
|
|
|
|
|
|
|
v2keymanager "github.com/prysmaticlabs/prysm/validator/keymanager/v2"
|
2020-07-21 02:05:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
2020-08-31 19:46:45 +00:00
|
|
|
Password() string
|
2020-09-15 14:52:07 +00:00
|
|
|
SetPassword(newPass string)
|
2020-07-21 02:05:23 +00:00
|
|
|
// Read methods for important wallet and accounts-related files.
|
|
|
|
ReadEncryptedSeedFromDisk(ctx context.Context) (io.ReadCloser, error)
|
2020-07-21 05:06:11 +00:00
|
|
|
ReadFileAtPath(ctx context.Context, filePath string, fileName string) ([]byte, error)
|
2020-07-21 02:05:23 +00:00
|
|
|
// Write methods to persist important wallet and accounts-related files to disk.
|
|
|
|
WriteFileAtPath(ctx context.Context, pathName string, fileName string, data []byte) error
|
|
|
|
WriteEncryptedSeedToDisk(ctx context.Context, encoded []byte) error
|
2020-09-09 18:29:17 +00:00
|
|
|
// Method for initializing a new keymanager.
|
|
|
|
InitializeKeymanager(ctx context.Context, skipMnemonicConfirm bool) (v2keymanager.IKeymanager, error)
|
2020-07-21 02:05:23 +00:00
|
|
|
}
|