Merge pull request #6302 from paritytech/ledger-sign
Add more descriptive error when signing/decrypting using hw wallet.
This commit is contained in:
commit
f19911660d
@ -512,6 +512,10 @@ pub fn execute<D: Dispatcher + 'static>(
|
||||
).boxed()
|
||||
},
|
||||
ConfirmationPayload::EthSignMessage(address, data) => {
|
||||
if accounts.is_hardware_address(address) {
|
||||
return future::err(errors::unsupported("Signing via hardware wallets is not supported.", None)).boxed();
|
||||
}
|
||||
|
||||
let hash = eth_data_hash(data);
|
||||
let res = signature(&accounts, address, hash, pass)
|
||||
.map(|result| result
|
||||
@ -522,6 +526,10 @@ pub fn execute<D: Dispatcher + 'static>(
|
||||
future::done(res).boxed()
|
||||
},
|
||||
ConfirmationPayload::Decrypt(address, data) => {
|
||||
if accounts.is_hardware_address(address) {
|
||||
return future::err(errors::unsupported("Decrypting via hardware wallets is not supported.", None)).boxed();
|
||||
}
|
||||
|
||||
let res = decrypt(&accounts, address, data, pass)
|
||||
.map(|result| result
|
||||
.map(RpcBytes)
|
||||
|
@ -71,6 +71,14 @@ pub fn public_unsupported(details: Option<String>) -> Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unsupported<T: Into<String>>(msg: T, details: Option<T>) -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: msg.into(),
|
||||
data: details.map(Into::into).map(Value::String),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn request_not_found() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::REQUEST_NOT_FOUND),
|
||||
|
Loading…
Reference in New Issue
Block a user