mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Review feedback
This commit is contained in:
parent
24d7201acd
commit
407128bc14
4 changed files with 15 additions and 11 deletions
|
|
@ -169,7 +169,7 @@ func (w *ledgerDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
|
|||
}
|
||||
|
||||
// SignData sends a blob of data to the USB device and waits for the user to confirm
|
||||
// or deny the transaction.
|
||||
// or deny the signing request.
|
||||
func (w *ledgerDriver) SignData(path accounts.DerivationPath, hash []byte) (common.Address, []byte, error) {
|
||||
return common.Address{}, nil, accounts.ErrNotSupported
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,12 +185,12 @@ func (w *trezorDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
|
|||
return w.trezorSign(path, tx, chainID)
|
||||
}
|
||||
|
||||
// SignData sends a blob of data to the xUSB device and waits for the user to confirm
|
||||
// or deny the transaction.
|
||||
func (w *trezorDriver) SignData(path accounts.DerivationPath, hash []byte) (common.Address, []byte, error) {
|
||||
// SignData sends a blob of data to the USB device and waits for the user to confirm
|
||||
// or deny the signing request.
|
||||
func (w *trezorDriver) SignData(path accounts.DerivationPath, data []byte) (common.Address, []byte, error) {
|
||||
request := &trezor.EthereumSignMessage{
|
||||
AddressN: path,
|
||||
Message: hash,
|
||||
Message: data,
|
||||
}
|
||||
response := new(trezor.EthereumMessageSignature)
|
||||
if _, err := w.trezorExchange(request, response); err != nil {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ type driver interface {
|
|||
SignTx(path accounts.DerivationPath, tx *types.Transaction, chainID *big.Int) (common.Address, *types.Transaction, error)
|
||||
|
||||
// SignData sends a blob of data to the USB device and waits for the user to confirm
|
||||
// or deny the transaction.
|
||||
// or deny the signing request.
|
||||
SignData(path accounts.DerivationPath, hash []byte) (common.Address, []byte, error)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,11 +142,15 @@ func (api *SignerAPI) sign(addr common.MixedcaseAddress, req *SignDataRequest, l
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pw, err := api.lookupOrQueryPassword(account.Address,
|
||||
"Password for signing",
|
||||
fmt.Sprintf("Please enter password for signing data with account %s, or just press 'RETURN'", account.Address.Hex()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// Only ask for the passphrase if the account is keystore based
|
||||
pw := ""
|
||||
if strings.Compare(wallet.URL().Scheme, "keystore") == 0 {
|
||||
pw, err = api.lookupOrQueryPassword(account.Address,
|
||||
"Password for signing",
|
||||
fmt.Sprintf("Please enter password for signing data with account %s", account.Address.Hex()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
// Sign the data with the wallet
|
||||
signature, err := wallet.SignDataWithPassphrase(account, pw, req.ContentType, req.Rawdata)
|
||||
|
|
|
|||
Loading…
Reference in a new issue