fswallet

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigPath the path of the Keystore V3 wallet path
	ConfigPath = "path"
	// ConfigFilenamesWith0xPrefix whether or not to use the 0x prefix on filenames, when using passwordExt password
	ConfigFilenamesWith0xPrefix = "filenames.with0xPrefix"
	// ConfigFilenamesPrimaryExt extension to append to the "from" address string to find the file (see metadata section for file types). All filenames must be lower case on disk.
	ConfigFilenamesPrimaryExt = "filenames.primaryExt"
	// ConfigFilenamesPrimaryMatchRegex allows filenames where the address can be extracted with a regular expression. Takes precedence over primaryExt
	ConfigFilenamesPrimaryMatchRegex = "filenames.primaryMatchRegex"
	// ConfigFilenamesPasswordExt extension to append to the "from" address string to find the password file (if not using a metadata file to specify the password file)
	ConfigFilenamesPasswordExt = "filenames.passwordExt"
	// ConfigFilenamesPasswordPath directory path where the password files should be found - default is the same path as the primary file
	ConfigFilenamesPasswordPath = "filenames.passwordPath"
	// ConfigFilenamesPasswordTrimSpace whether to trim whitespace from passwords loaded from files (such as trailing newline characters)
	ConfigFilenamesPasswordTrimSpace = "filenames.passwordTrimSpace"
	// ConfigDefaultPasswordFile default password file to use if neither the metadata, or passwordExtension find a password
	ConfigDefaultPasswordFile = "defaultPasswordFile"
	// ConfigDisableListener disable the filesystem listener that detects newly added keys automatically
	ConfigDisableListener = "disableListener"
	// ConfigSignerCacheSize the number of signing keys to keep in memory
	ConfigSignerCacheSize = "signerCacheSize"
	// ConfigSignerCacheTTL the time to keep an unused signing key in memory
	ConfigSignerCacheTTL = "signerCacheTTL"
	// ConfigMetadataFormat format to parse the metadata - supported: auto (from extension) / filename / toml / yaml / json (please quote "0x..." strings in YAML)
	ConfigMetadataFormat = "metadata.format"
	// ConfigMetadataKeyFileProperty use for toml/yaml/json to find the name of the file containing the keystorev3 file
	ConfigMetadataKeyFileProperty = "metadata.keyFileProperty"
	// ConfigMetadataPasswordFileProperty use for toml/yaml to find the name of the file containing the keystorev3 file
	ConfigMetadataPasswordFileProperty = "metadata.passwordFileProperty"
)

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(section config.Section)

Types

type Config

type Config struct {
	Path                string
	DefaultPasswordFile string
	SignerCacheSize     string
	SignerCacheTTL      string
	DisableListener     bool
	Filenames           FilenamesConfig
	Metadata            MetadataConfig
}

func ReadConfig

func ReadConfig(section config.Section) *Config

type FilenamesConfig

type FilenamesConfig struct {
	PrimaryMatchRegex string
	PrimaryExt        string
	PasswordExt       string
	PasswordPath      string
	PasswordTrimSpace bool
	With0xPrefix      bool
}

type MetadataConfig

type MetadataConfig struct {
	Format               string
	KeyFileProperty      string
	PasswordFileProperty string
}

type Wallet

type Wallet interface {
	ethsigner.WalletTypedData
	GetWalletFile(ctx context.Context, addr ethtypes.Address0xHex) (keystorev3.WalletFile, error)
	AddListener(listener chan<- ethtypes.Address0xHex)
}

Wallet is a directory containing a set of KeystoreV3 files, conforming to the ethsigner.Wallet interface and providing notifications when new keys are added to the wallet (via FS listener).

func NewFilesystemWallet

func NewFilesystemWallet(ctx context.Context, conf *Config, initialListeners ...chan<- ethtypes.Address0xHex) (ww Wallet, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL