move installer to the cmd pkg

This commit is contained in:
Andrea Franz 2018-11-07 17:38:53 +01:00
parent 07815b9d22
commit 4da759422b
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
3 changed files with 9 additions and 15 deletions

View File

@ -1,4 +1,4 @@
package actionsets package main
import ( import (
"crypto/rand" "crypto/rand"

View File

@ -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")

View File

@ -1,5 +0,0 @@
package actionsets
import "github.com/ethereum/go-ethereum/log"
var logger = log.New("package", "hardware-wallet-go/lightwallet/actionsets")