Clef: USB hw wallet support (#17756)

* signer: implement USB interaction with hw wallets

* signer: fix failing testcases
This commit is contained in:
Martin Holst Swende
2018-09-28 12:47:57 +02:00
committed by GitHub
parent 2c110c81ee
commit dcaabfe7f6
7 changed files with 169 additions and 3 deletions

View File

@ -83,6 +83,22 @@ func (ui *CommandlineUI) readPasswordText(inputstring string) string {
return string(text)
}
func (ui *CommandlineUI) OnInputRequired(info UserInputRequest) (UserInputResponse, error) {
fmt.Println(info.Title)
fmt.Println(info.Prompt)
if info.IsPassword {
text, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Error("Failed to read password", "err", err)
}
fmt.Println("-----------------------")
return UserInputResponse{string(text)}, err
}
text := ui.readString()
fmt.Println("-----------------------")
return UserInputResponse{text}, nil
}
// confirm returns true if user enters 'Yes', otherwise false
func (ui *CommandlineUI) confirm() bool {
fmt.Printf("Approve? [y/N]:\n")