console: use keypad based pinpad (Trezor request)

parent 5d9ac49c
...@@ -110,20 +110,15 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) { ...@@ -110,20 +110,15 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) {
} }
// Trezor PIN matrix input requested, display the matrix to the user and fetch the data // Trezor PIN matrix input requested, display the matrix to the user and fetch the data
fmt.Fprintf(b.printer, "Look at the device for number positions\n\n") fmt.Fprintf(b.printer, "Look at the device for number positions\n\n")
fmt.Fprintf(b.printer, "a | b | c\n") fmt.Fprintf(b.printer, "7 | 8 | 9\n")
fmt.Fprintf(b.printer, "--+---+--\n") fmt.Fprintf(b.printer, "--+---+--\n")
fmt.Fprintf(b.printer, "d | e | f\n") fmt.Fprintf(b.printer, "4 | 5 | 6\n")
fmt.Fprintf(b.printer, "--+---+--\n") fmt.Fprintf(b.printer, "--+---+--\n")
fmt.Fprintf(b.printer, "g | h | i\n\n") fmt.Fprintf(b.printer, "1 | 2 | 3\n\n")
if input, err := b.prompter.PromptPassword("Please enter current PIN: "); err != nil { if input, err := b.prompter.PromptPassword("Please enter current PIN: "); err != nil {
throwJSException(err.Error()) throwJSException(err.Error())
} else { } else {
// Transform the alphabetical input to numbers
mapping := map[string]string{"a": "7", "b": "8", "c": "9", "d": "4", "e": "5", "f": "6", "g": "1", "h": "2", "i": "3"}
for from, to := range mapping {
input = strings.Replace(input, from, to, -1)
}
passwd, _ = otto.ToValue(input) passwd, _ = otto.ToValue(input)
} }
if val, err = call.Otto.Call("jeth.openWallet", nil, wallet, passwd); err != nil { if val, err = call.Otto.Call("jeth.openWallet", nil, wallet, passwd); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment