mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/scwallet: Add a switch to enable smartcard support
This commit is contained in:
parent
f0b878d56d
commit
0da1424e2f
7 changed files with 27 additions and 10 deletions
|
|
@ -64,6 +64,7 @@ var (
|
|||
utils.KeyStoreDirFlag,
|
||||
utils.ExternalSignerFlag,
|
||||
utils.NoUSBFlag,
|
||||
utils.SmartCardFlag,
|
||||
utils.DashboardEnabledFlag,
|
||||
utils.DashboardAddrFlag,
|
||||
utils.DashboardPortFlag,
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
utils.DataDirFlag,
|
||||
utils.KeyStoreDirFlag,
|
||||
utils.NoUSBFlag,
|
||||
utils.SmartCardFlag,
|
||||
utils.NetworkIdFlag,
|
||||
utils.TestnetFlag,
|
||||
utils.RinkebyFlag,
|
||||
|
|
|
|||
|
|
@ -224,9 +224,10 @@ const testPassphrase = "swarm-test-passphrase"
|
|||
func getTestAccount(t *testing.T, dir string) (conf *node.Config, account accounts.Account) {
|
||||
// create key
|
||||
conf = &node.Config{
|
||||
DataDir: dir,
|
||||
IPCPath: "bzzd.ipc",
|
||||
NoUSB: true,
|
||||
DataDir: dir,
|
||||
IPCPath: "bzzd.ipc",
|
||||
NoUSB: true,
|
||||
SmartCard: false,
|
||||
}
|
||||
n, err := node.New(conf)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -127,6 +127,10 @@ var (
|
|||
Name: "nousb",
|
||||
Usage: "Disables monitoring for and managing USB hardware wallets",
|
||||
}
|
||||
SmartCardFlag = cli.BoolTFlag{
|
||||
Name: "smartcard",
|
||||
Usage: "Enables support for smartcard",
|
||||
}
|
||||
NetworkIdFlag = cli.Uint64Flag{
|
||||
Name: "networkid",
|
||||
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
|
||||
|
|
@ -1138,6 +1142,9 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
if ctx.GlobalIsSet(NoUSBFlag.Name) {
|
||||
cfg.NoUSB = ctx.GlobalBool(NoUSBFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(SmartCardFlag.Name) {
|
||||
cfg.SmartCard = ctx.GlobalBoolT(SmartCardFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(InsecureUnlockAllowedFlag.Name) {
|
||||
cfg.InsecureUnlockAllowed = ctx.GlobalBool(InsecureUnlockAllowedFlag.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,9 @@ type Config struct {
|
|||
// NoUSB disables hardware wallet monitoring and connectivity.
|
||||
NoUSB bool `toml:",omitempty"`
|
||||
|
||||
// SmartCard activates smartcard wallet monitoring and connectivity.
|
||||
SmartCard bool `toml:",omitempty"`
|
||||
|
||||
// IPCPath is the requested location to place the IPC endpoint. If the path is
|
||||
// a simple file name, it is placed inside the data directory (or on the root
|
||||
// pipe path on Windows), whereas if it's a resolvable path name (absolute or
|
||||
|
|
@ -505,11 +508,13 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
|
|||
backends = append(backends, trezorhub)
|
||||
}
|
||||
}
|
||||
// Start a smart card hub
|
||||
if schub, err := scwallet.NewHub(scwallet.Scheme, keydir); err != nil {
|
||||
log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err))
|
||||
} else {
|
||||
backends = append(backends, schub)
|
||||
if conf.SmartCard {
|
||||
// Start a smart card hub
|
||||
if schub, err := scwallet.NewHub(scwallet.Scheme, keydir); err != nil {
|
||||
log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err))
|
||||
} else {
|
||||
backends = append(backends, schub)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ func (e *ExecAdapter) NewNode(config *NodeConfig) (Node, error) {
|
|||
conf.Stack.P2P.NoDiscovery = true
|
||||
conf.Stack.P2P.NAT = nil
|
||||
conf.Stack.NoUSB = true
|
||||
conf.Stack.SmartCard = false
|
||||
|
||||
// listen on a localhost port, which we set when we
|
||||
// initialise NodeConfig (usually a random port)
|
||||
|
|
|
|||
|
|
@ -105,8 +105,9 @@ func (s *SimAdapter) NewNode(config *NodeConfig) (Node, error) {
|
|||
Dialer: s,
|
||||
EnableMsgEvents: config.EnableMsgEvents,
|
||||
},
|
||||
NoUSB: true,
|
||||
Logger: log.New("node.id", id.String()),
|
||||
NoUSB: true,
|
||||
SmartCard: false,
|
||||
Logger: log.New("node.id", id.String()),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue