From db568a61e2a98880ab308bf2224aa34073dc7f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 1 Aug 2017 17:45:17 +0200 Subject: accounts, console, internal: support trezor hardware wallet --- internal/ethapi/api.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/ethapi') diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7874b7101..6b9c151cf 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -246,6 +246,22 @@ func (s *PrivateAccountAPI) ListWallets() []rawWallet { return wallets } +// OpenWallet initiates a hardware wallet opening procedure, establishing a USB +// connection and attempting to authenticate via the provided passphrase. Note, +// the method may return an extra challenge requiring a second open (e.g. the +// Trezor PIN matrix challenge). +func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error { + wallet, err := s.am.Wallet(url) + if err != nil { + return err + } + pass := "" + if passphrase != nil { + pass = *passphrase + } + return wallet.Open(pass) +} + // DeriveAccount requests a HD wallet to derive a new account, optionally pinning // it for later reuse. func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) { -- cgit v1.2.3