-
Notifications
You must be signed in to change notification settings - Fork 825
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
Use Signed Message for Key Devrivation #1981
Merged
Merged
+404
−104
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/ct_module #1981 +/- ##
=====================================================
+ Coverage 60.89% 60.99% +0.09%
=====================================================
Files 283 284 +1
Lines 26982 27029 +47
=====================================================
+ Hits 16431 16485 +54
+ Misses 9289 9280 -9
- Partials 1262 1264 +2
|
dssei
reviewed
Dec 11, 2024
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.
lgtm
dssei
approved these changes
Dec 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes and provide context
Currently, the CT Module relies directly on the private key for deriving keys. For each account, a new keypair is deterministically generated using the KeyGen(privateKey, denom) method, which computes the SHA256 of the privateKey with denom as the salt, then uses that hash to create a private key (random number)
The benefit of doing this is that users can generate a key that is as secure as their addresses' ecdsa private key, without having to manage additional keys.
This is fine for clients such as seid which have direct access to the users private key, but the majority of other clients (wallets etc), do not have direct access to the users private key. This would make the feature very difficult to use outside of seid.
To make things easier for wallets, the change proposed here is that instead of using
SHA256Hash(privatekey, denom)
as the key generation function, we useSign(privateKey, denom)
, then SHA256 hash it one more time with an arbitrary salt to prevent the signature from being used.Sign(privateKey, denom) is as secure, since it cannot be generated by anyone except with knowledge of the ecdsa private key. However, this enables the key generation to be performed by Wallets, enabling applications to derive the keyPair on the client side by requesting that the user sign the denom. This will increase the future usability of this feature and integratability with dapps.
On the client side, they can generate Sign(privateKey, denom) using EVM wallet clients with
One note is that this implementation only enables EVM wallets to do this - cosmos wallets have different signing methods and will still not be able to interact with this module naturally.
more work to be done to look into how to add usability to this module.
This PR is dependent on the changes in sei-protocol/sei-cryptography#7
Testing performed to validate your change