Closed JustinSeidl closed 1 year ago
@q9f is this something you could assist with?
Yes, what are you trying to do? What is message?
We can sign, personal sign, and sign typed data out of the box:
https://github.com/q9f/eth.rb/wiki/Signatures-&-Recovery
Without any code, I would guess you are looking for personal_sign
I appreciate the response and assistance. This is a little outside of my comfort zone and our previous developer is not available to assist us with the transition to your version of the gem.
We are working with a payment processor, Sila, who requires authentication of API requests with private ETH keys. https://docs.silamoney.com/docs/process-overview
We wrapped their API in a Ruby gem and have been using it for a little over two years. The error posted above is the response we get after transitioning to your version of the gem (which we desperately need and welcome).
Here is a gist of the file the code lives in. This file generates the headers for the API calls. https://gist.github.com/JustinSeidl/9d67f2ae3c2200bc86daf5842189b57d
Thanks for sharing. I think you have to rewrite the function to:
def sila_personal_sign(key, message)
key.sign(Eth::Util.keccak256(message))
end
I'm pretty certain the rotation of the v
and the conversion to hex is no longer required. Hopefully you have tests :)
Just checked the Sila spec:
- A hash is generated from the message (using SHA3/Keccak-256).
I'm fairly confident with the fix above.
If this does not work, you can also add me to a private repo (if you feel confident with this) and I can see if I can patch it.
@q9f changed the code to your suggestion and the tests passed! This is much cleaner than the previous version.
I can't express how much we appreciate your timely help.
Happy to sponsor the project to show and continue to show my gratitude for your work if you decide to open up sponsorships on this repo. Let me know if you do!
Glad it worked!
There is currently no way to sponsor me, but I appreciate it!
Our team is converting from the previous ruby-eth gem to this version of the gem.
In our code we had the following:
Eth::Util.bin_to_hex(key.sign(message)).bytes.rotate(1).pack('c*')
We are now receiving an error that we don't know how to solve for:
Any help on what we are missing to make the conversion?