-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: signatures #96
base: master
Are you sure you want to change the base?
feat: signatures #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check eip-712 https://github.com/Mrtenz/eip-712 ?
) public pure returns (bytes32 r_, bytes32 s_, uint8 v_) { | ||
require(sig.length == 65, "invalid signature length"); | ||
|
||
assembly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you can avoid assembly and send r,s,v directly into recoverSigner, you would simplyfy contract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the assemly part sets values for r_
, s_
and v_
, those are output parameters.
*/ | ||
return | ||
keccak256( | ||
abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the added prefix string would make it an invalid as transaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the way how Bee client signs all message
https://github.com/ethersphere/bee/blob/master/pkg/crypto/signer.go#L82-L83
we do not check signed blockchain transactions with this function.
I am kinda missing context where is this going to be used ? Will this be used to verify postageStamp signer and only for it ? If you plan to do any multisig kind verification then I have a huntch the replay attack could happen since there is no nonce. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if r,s,v can be supplied from outside, i would remove assembly part
the postage stamp sig check will be used in the storage incentives. though, it can be a utility function for something else as well in the future.
exactly. how can you have man in the middle attack here? you need the private key from of postage stamp owner to sign the message. |
if timestamp would not change, one could cache signature. But since timestampe is changing it acts as a nounce, is always higher then before, then it can not occour. |
Added smart contract library
Signature.sol
that contains all helper function to signature handling and addedPostageStampSig
andSocSig
that shows how to utilize that with the functionality to recover Ethereum address from postage stamp and Single Owner Chunk signatures, respectively.