signer: change the stdio jsonrpc to use legacy namespace conventions (#19047)

This PR will will break existing UIs, since it changes all calls like ApproveSignTransaction to be on the form ui_approveSignTransaction.

This is to make it possible for the UI to reuse the json-rpc library from go-ethereum, which uses this convention.

Also, this PR removes some unused structs, after import/export were removed from the external api (so no longer needs internal methods for approval)

One more breaking change is introduced, removing passwords from the ApproveSignTxResponse and the likes. This makes the manual interface more like the rulebased interface, and integrates nicely with the credential storage. Thus, the way it worked before, it would be tempting for the UI to implement 'remember password' functionality. The way it is now, it will be easy instead to tell clef to store passwords and use them.

If a pw is not found in the credential store, the user is prompted to provide the password.
This commit is contained in:
Martin Holst Swende
2019-03-07 10:56:08 +01:00
committed by Péter Szilágyi
parent eb199f1fc2
commit 5f94f8c7e7
13 changed files with 399 additions and 467 deletions

View File

@ -35,8 +35,7 @@ Response to SignDataRequest
Example:
```json
{
"approved": true,
"Password": "apassword"
"approved": true
}
```
### SignDataResponse - deny
@ -46,8 +45,7 @@ Response to SignDataRequest
Example:
```json
{
"approved": false,
"Password": ""
"approved": false
}
```
### SignTxRequest
@ -89,9 +87,9 @@ Example:
}
}
```
### SignDataResponse - approve
### SignTxResponse - approve
Response to SignDataRequest. This response needs to contain the `transaction`, because the UI is free to make modifications to the transaction.
Response to request to sign a transaction. This response needs to contain the `transaction`, because the UI is free to make modifications to the transaction.
Example:
```json
@ -105,19 +103,26 @@ Example:
"nonce": "0x4",
"data": "0x04030201"
},
"approved": true,
"password": "apassword"
"approved": true
}
```
### SignDataResponse - deny
### SignTxResponse - deny
Response to SignDataRequest. When denying a request, there's no need to provide the transaction in return
Response to SignTxRequest. When denying a request, there's no need to provide the transaction in return
Example:
```json
{
"approved": false,
"Password": ""
"transaction": {
"from": "0x",
"to": null,
"gas": "0x0",
"gasPrice": "0x0",
"value": "0x0",
"nonce": "0x0",
"data": null
},
"approved": false
}
```
### OnApproved - SignTransactionResult
@ -164,7 +169,7 @@ Example:
```
### UserInputResponse
Response to SignDataRequest
Response to UserInputRequest
Example:
```json
@ -198,7 +203,7 @@ Example:
}
}
```
### UserInputResponse
### ListResponse
Response to list request. The response contains a list of all addresses to show to the caller. Note: the UI is free to respond with any address the caller, regardless of whether it exists or not