CLI command to sign and verify operator's signature#613
Conversation
We added functions to let operator running the client to calculate and verify ethereum signatures. This gives easy way of confirming messages with operator's key without a need to pull the key out of the node running the client or installing additional libraries to handle the signing.
We can reuse the part where we provide output directory for a file in other functions. Here we extracted this code.
We want to enhance the code for ethereum signing so it may be a good idea to extract these to a separate file.
We used wrong name to set the value for key file path variable. We also don't need to introduce another variable, we can use just one.
We expect a signature in a common Ethereum signature JSON format:
{
"address": "<address>",
"msg": "<content>",
"sig": "<signature>",
"version": "2"
}
Added a possibility to output the signature to a file and read a file on
verification.
|
Updated the code to handle signature format specified in https://coda.io/d/Operator-Information_d846PmoUIrs/Interim-BTC-Recovery-Process_sutgB#_lu22Q |
Do you think we can add to the doc file a note about where the default config is? Is it intentional that we will throw an error |
Cleaning the user provided path should solve gosec discovered issue.
It's a flag inherited from the main command https://github.com/keep-network/keep-ecdsa/blob/master/main.go#L53-L58 the information can be obtained by running |
It's not needed in this case. I'll update the code. |
If a file with signature already exists overwrite it. We don't want it to be default bahaviour so left check fo key shares files.
We can expect file mode to be provided to outputData function instead of the boolen value. We don't need to check if the file exists before writing to it as access permissions of the file will prevent us from overwriting it if configured properly.
…a into operator-signing
|
Tested:
|
We added functions to let the operator running the client calculate and verify ethereum signatures. This gives an easy way of confirming messages with the operator's key without a need to pull the key out of the node running the client or installing additional libraries to handle the signing.
It calculates a signature in ethereum
R, S, Vformat. TheVproperty is needed to recover a public key (and address) from a signature on verification.Closes: #612
Sign message
Documentation
Examples
Verify signature
Documentation
Examples