derohe icon indicating copy to clipboard operation
derohe copied to clipboard

Wallet RPC for `filesign` (signdata)

Open g45t345rt opened this issue 2 years ago • 2 comments

Is it possible to have Wallet RPC calls for filesign (signdata) https://github.com/deroproject/derohe/blob/5be577718b22a68aa296be15207c2e38d956585f/walletapi/wallet.go#L533

Would be necessary create some kind of authentication services with dero-rpc-bridge and many other useful interactions.

After a quick chat with Dank, the fileverify (checksignature) is not mandatory. The function should be copied or implement in the dapps/server language to verify the signature.

checksignature https://github.com/deroproject/derohe/blob/5be577718b22a68aa296be15207c2e38d956585f/walletapi/wallet.go#L557

g45t345rt avatar Jul 24 '22 16:07 g45t345rt

Do you mean something like this? SignData request:

curl --silent http://localhost:40403/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"signdata","params":{"data":"48656c6c6f2066726f6d206d6d617263656c203a29"}}' -H 'Content-Type: application/json' | jq .

SignData response:

{
  "jsonrpc": "2.0",
  "id": "0",
  "result": {
    "signed_data": "2d2d2d2d2d424547494e204445524f205349474e4544204d4553534147452d2d2d2d2d0a416464726573733a206465746f317179726730686a33757974786d377a616c787575376e70787773706166776e613736643971396137776376747a78786d327637776371676672616178660a433a20316366633430333836666237613164626661643932366230303337373331316133326366656433373037636632303035363564353934663738656230623064330a533a20313635613136663438363366646365303339663931633365373937626662363933393738356337313161343037373631393237636330643565643263393630650a0a53475673624738675a6e4a7662534274625746795932567349446f700a2d2d2d2d2d454e44204445524f205349474e4544204d4553534147452d2d2d2d2d0a"
  }
}

CheckSignature request:

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

CheckSignature response:

{
  "jsonrpc": "2.0",
  "id": "0",
  "result": {
    "signer": "deto1qyrg0hj3uytxm7zalxuu7npxwspafwna76d9q9a7wcvtzxxm2v7wcqgfraaxf",
    "message": "48656c6c6f2066726f6d206d6d617263656c203a29"
  }
}

Input and output data is in hex form. You need to convert the hex data to ASCII and vice versa. I can add an additional field to switch between hex and string input.

"hex":true/false

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

hope to see this implemented. needed to make ux friendly state channels possible for some type of applications (which also would benefit from a signature verification function built into dvm)

mari7012 avatar Jul 29 '22 11:07 mari7012