derohe icon indicating copy to clipboard operation
derohe copied to clipboard

RPC calls signdata and checksignature

Open 8lecramm opened this issue 2 years ago • 1 comments

Related to #79.

If input is given in plaintext, "plain" should be set to 'true'. The same applies to the response message of 'checksignature'.

curl http://localhost:40403/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"signdata","params":{"data":"Hello from mmarcel :)","plain":true}}' -H 'Content-Type: application/json' | jq .

{
  "jsonrpc": "2.0",
  "id": "0",
  "result": {
    "signed_data": "2d2d2d2d2d424547494e204445524f205349474e4544204d4553534147452d2d2d2d2d0a416464726573733a206465746f317179726730686a33757974786d377a616c787575376e70787773706166776e613736643971396137776376747a78786d327637776371676672616178660a433a20313230306331393135613933333266386335383132303265646431663763393661363537616232363931623030366331336330646263643331343033396136320a533a20323264613965373132656361346164383033353835393832333635636562353530383663633637333036353037326264636234303465313935333339393364660a0a53475673624738675a6e4a7662534274625746795932567349446f700a2d2d2d2d2d454e44204445524f205349474e4544204d4553534147452d2d2d2d2d0a"
  }
}
curl http://localhost:40403/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"checksignature","params":{"data":"2d2d2d2d2d424547494e204445524f205349474e4544204d4553534147452d2d2d2d2d0a416464726573733a206465746f317179726730686a33757974786d377a616c787575376e70787773706166776e613736643971396137776376747a78786d327637776371676672616178660a433a20313230306331393135613933333266386335383132303265646431663763393661363537616232363931623030366331336330646263643331343033396136320a533a20323264613965373132656361346164383033353835393832333635636562353530383663633637333036353037326264636234303465313935333339393364660a0a53475673624738675a6e4a7662534274625746795932567349446f700a2d2d2d2d2d454e44204445524f205349474e4544204d4553534147452d2d2d2d2d0a","plain":true}}' -H 'Content-Type: application/json' | jq .

{
  "jsonrpc": "2.0",
  "id": "0",
  "result": {
    "signer": "deto1qyrg0hj3uytxm7zalxuu7npxwspafwna76d9q9a7wcvtzxxm2v7wcqgfraaxf",
    "message": "Hello from mmarcel :)"
  }
}

8lecramm avatar Jul 29 '22 19:07 8lecramm

Can we have better clarity on structure field names so that things can have better inference. Like during signature check data will always be hex so better name something which shows hex data type etc.

CaptainDero avatar Jun 11 '23 14:06 CaptainDero