Skip to content
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

Cw 565 sign messages #1378

Merged
merged 124 commits into from
Aug 17, 2024
Merged

Cw 565 sign messages #1378

merged 124 commits into from
Aug 17, 2024

Conversation

fossephate
Copy link
Contributor

Issue Number (if Applicable): Fixes #

Description

Please include a summary of the changes and which issue is fixed / feature is added.

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods

lib/src/screens/dashboard/widgets/sign_form.dart Outdated Show resolved Hide resolved
lib/view_model/dashboard/sign_view_model.dart Outdated Show resolved Hide resolved
lib/view_model/dashboard/dashboard_view_model.dart Outdated Show resolved Hide resolved
res/values/strings_de.arb Outdated Show resolved Hide resolved
res/values/strings_de.arb Outdated Show resolved Hide resolved
res/values/strings_de.arb Outdated Show resolved Hide resolved
cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart Outdated Show resolved Hide resolved
cw_bitcoin/lib/electrum_wallet.dart Outdated Show resolved Hide resolved
cw_bitcoin/lib/electrum_wallet.dart Show resolved Hide resolved
fossephate and others added 6 commits May 29, 2024 16:21
…CW-565-sign-messages

� Conflicts:
�	lib/bitcoin/cw_bitcoin.dart
�	lib/entities/default_settings_migration.dart
�	lib/src/screens/dashboard/pages/cake_features_page.dart
cw_monero/ios/Classes/monero_api.cpp Outdated Show resolved Hide resolved
pubspec_base.yaml Show resolved Hide resolved
lib/view_model/wallet_creation_vm.dart Outdated Show resolved Hide resolved
lib/view_model/dashboard/dashboard_view_model.dart Outdated Show resolved Hide resolved
lib/view_model/auth_view_model.dart Outdated Show resolved Hide resolved
cw_wownero/pubspec.yaml Outdated Show resolved Hide resolved
lib/src/screens/dashboard/widgets/sign_form.dart Outdated Show resolved Hide resolved
return await verifySignature(
message: messageBytes,
signature: sigBytes,
publicKey: Ed25519HDPublicKey(pubKeyBytes),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this comparing with the public key included in the signature? which will always be correct, shouldn't we use publicKey: _keyPairData!.publicKey instead and just return the sigBytes from bytesFromSigString function? or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, you're right this shouldn't be using the public key from the signature
er, actually this is fine, if we can derive the same address as the address parameter and see that they match

your suggestion of using _keyPairData!.publicKey would only work for verifying your own messages and not other peoples

basically I just need to figure out how to derive addresses from public keys and check to see if the address provided matches the one derived from the included public key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: I figured out how the address generation works I just need to test it

cw_nano/lib/nano_client.dart Outdated Show resolved Hide resolved
Comment on lines 697 to 703
final pk = await getPrivateKey(
mnemonic: _mnemonic,
privateKey: _hexPrivateKey,
password: _password,
);
return EthSigUtil.signPersonalMessage(
privateKey: bytesToHex(pk.privateKey),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use _evmChainPrivateKey it's already set, and it handles hardware wallet case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the change for the sign function but I'm unsure of what the flow really looks like for hardware wallets @konstantinullrich do any additional changes need to be made to the UI? will a prompt just appear if a hardware wallet is connected and signMessage is called or is there something else that needs to be added?

lib/src/screens/receive/receive_page.dart Outdated Show resolved Hide resolved
@OmarHatem28
Copy link
Contributor

will merge and disable it for hardware wallets until it's added and tested

@OmarHatem28 OmarHatem28 merged commit 83ef61e into main Aug 17, 2024
2 checks passed
@OmarHatem28 OmarHatem28 deleted the CW-565-sign-messages branch August 17, 2024 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants