move installer to the cmd pkg
This commit is contained in:
parent
07815b9d22
commit
4da759422b
|
@ -1,4 +1,4 @@
|
||||||
package actionsets
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
|
@ -12,10 +12,9 @@ import (
|
||||||
|
|
||||||
"github.com/ebfe/scard"
|
"github.com/ebfe/scard"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/status-im/hardware-wallet-go/lightwallet/actionsets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type commandFunc func(*actionsets.Installer) error
|
type commandFunc func(*Installer) error
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logger = log.New("package", "status-go/cmd/hardware-wallet-light")
|
logger = log.New("package", "status-go/cmd/hardware-wallet-light")
|
||||||
|
@ -131,7 +130,7 @@ func main() {
|
||||||
logger.Debug("card protocol", "T", "unknown")
|
logger.Debug("card protocol", "T", "unknown")
|
||||||
}
|
}
|
||||||
|
|
||||||
i := actionsets.NewInstaller(card)
|
i := NewInstaller(card)
|
||||||
if f, ok := commands[command]; ok {
|
if f, ok := commands[command]; ok {
|
||||||
err = f(i)
|
err = f(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -180,7 +179,7 @@ func askUint8(description string) uint8 {
|
||||||
return uint8(i)
|
return uint8(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandInstall(i *actionsets.Installer) error {
|
func commandInstall(i *Installer) error {
|
||||||
if *flagCapFile == "" {
|
if *flagCapFile == "" {
|
||||||
logger.Error("you must specify a cap file path with the -f flag\n")
|
logger.Error("you must specify a cap file path with the -f flag\n")
|
||||||
usage()
|
usage()
|
||||||
|
@ -202,7 +201,7 @@ func commandInstall(i *actionsets.Installer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandInfo(i *actionsets.Installer) error {
|
func commandInfo(i *Installer) error {
|
||||||
info, err := i.Info()
|
info, err := i.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -219,7 +218,7 @@ func commandInfo(i *actionsets.Installer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandDelete(i *actionsets.Installer) error {
|
func commandDelete(i *Installer) error {
|
||||||
err := i.Delete()
|
err := i.Delete()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -230,7 +229,7 @@ func commandDelete(i *actionsets.Installer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandInit(i *actionsets.Installer) error {
|
func commandInit(i *Installer) error {
|
||||||
secrets, err := i.Init()
|
secrets, err := i.Init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -243,7 +242,7 @@ func commandInit(i *actionsets.Installer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandPair(i *actionsets.Installer) error {
|
func commandPair(i *Installer) error {
|
||||||
pairingPass := ask("Pairing password")
|
pairingPass := ask("Pairing password")
|
||||||
pin := ask("PIN")
|
pin := ask("PIN")
|
||||||
info, err := i.Pair(pairingPass, pin)
|
info, err := i.Pair(pairingPass, pin)
|
||||||
|
@ -257,7 +256,7 @@ func commandPair(i *actionsets.Installer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandStatus(i *actionsets.Installer) error {
|
func commandStatus(i *Installer) error {
|
||||||
index := askUint8("Pairing index")
|
index := askUint8("Pairing index")
|
||||||
key := askHex("Pairing key")
|
key := askHex("Pairing key")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package actionsets
|
|
||||||
|
|
||||||
import "github.com/ethereum/go-ethereum/log"
|
|
||||||
|
|
||||||
var logger = log.New("package", "hardware-wallet-go/lightwallet/actionsets")
|
|
Loading…
Reference in New Issue