-
Notifications
You must be signed in to change notification settings - Fork 346
CW-723-Add-Monero-support-to-the-Shared-Seed-feature-in-Cake #2131
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
Merged
OmarHatem28
merged 27 commits into
main
from
CW-723-Add-Monero-support-to-the-Shared-Seed-feature-in-Cake
Apr 10, 2025
Merged
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
d469a91
feat: add exodus style bip39 to monero legacy seed
konstantinullrich 28b4ef0
feat: restore monero wallet from bip39 and add test
konstantinullrich 705bf76
bug: fix wrong naming in CI
konstantinullrich 9ee0cd7
feat: add monero bip39 UI flow
konstantinullrich b22bfca
Merge branch 'refs/heads/main' into CW-723-Add-Monero-support-to-the-…
konstantinullrich d891f6d
fix: monero.dart generation
konstantinullrich 3f109c9
fix: skip monero_wallet_service tests till CI is fixed
konstantinullrich 993143a
ci: copy monero_libwallet2_api_c.so to /usr/lib for testing
MrCyjaneK 3b39da5
Merge branch 'main' into CW-723-Add-Monero-support-to-the-Shared-Seed…
konstantinullrich eea3558
fix: monero wallet creation credentials default to bip39 if mnemonic …
konstantinullrich 6515383
Merge branch 'main' into CW-723-Add-Monero-support-to-the-Shared-Seed…
konstantinullrich 63de3bd
fix: do not skip monero wallets services test
konstantinullrich ebc152a
fix: Include non bip39 monero wallets on Wallet Group
konstantinullrich 56d1db2
fix: null pointer stemming from missing language selector if seed is …
konstantinullrich 41c2211
fix: Fixes to Bip39 Creation and restore
konstantinullrich 281e19c
fix: Fixes to Bip39 restore
konstantinullrich 775b09f
Merge branch 'main' into CW-723-Add-Monero-support-to-the-Shared-Seed…
konstantinullrich 22b56f3
feat (cw_monero): Store monero wallet after bip39 creation
konstantinullrich ed77a78
feat (cw_monero): remove prints from monero_wallet_service_test.dart
konstantinullrich 8a6bef7
Merge branch 'main' into CW-723-Add-Monero-support-to-the-Shared-Seed…
konstantinullrich c3b6448
fix: exception during seed language autodetect
konstantinullrich 0aa1ba8
feat (cw_monero): Add support for passphrases on bip39 seeds
konstantinullrich 74feb91
feat (cw_monero): Add support for passphrases on bip39 seeds
konstantinullrich 11c070e
fix: seed language selection for recovering bip39 wallets
konstantinullrich a419ba4
style: improve readability of isLegacySeedOnly in wallet_keys_view_mo…
konstantinullrich 7ba6f85
feat: hide monero seed type selector from advanced settings when crea…
konstantinullrich 44a079a
fix(cw_monero): use named arguments for bip39_seed tests
konstantinullrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:bip32/bip32.dart' as bip32; | ||
| import 'package:bip39/bip39.dart' as bip39; | ||
| import 'package:polyseed/polyseed.dart'; | ||
|
|
||
| bool isBip39Seed(String mnemonic) => bip39.validateMnemonic(mnemonic); | ||
|
|
||
| String getBip39Seed() => bip39.generateMnemonic(); | ||
|
|
||
| String getLegacySeedFromBip39(String mnemonic, [int accountIndex = 0]) { | ||
| final seed = bip39.mnemonicToSeed(mnemonic); | ||
|
|
||
| final bip32KeyPair = | ||
| bip32.BIP32.fromSeed(seed).derivePath("m/44'/128'/$accountIndex'/0/0"); | ||
|
|
||
| final spendKey = _reduceECKey(bip32KeyPair.privateKey!); | ||
|
|
||
| return LegacySeedLang.getByEnglishName("English") | ||
| .encodePhrase(spendKey.toHexString()); | ||
| } | ||
|
|
||
| const _ed25519CurveOrder = | ||
| "1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED"; | ||
|
|
||
| Uint8List _reduceECKey(Uint8List buffer) { | ||
| final curveOrder = BigInt.parse(_ed25519CurveOrder, radix: 16); | ||
| final bigNumber = _readBytes(buffer); | ||
|
|
||
| var result = bigNumber % curveOrder; | ||
|
|
||
| final resultBuffer = Uint8List(32); | ||
| for (var i = 0; i < 32; i++) { | ||
| resultBuffer[i] = (result & BigInt.from(0xff)).toInt(); | ||
| result = result >> 8; | ||
| } | ||
|
|
||
| return resultBuffer; | ||
| } | ||
|
|
||
| /// Read BigInt from a little-endian Uint8List | ||
| /// From https://github.com/dart-lang/sdk/issues/32803#issuecomment-387405784 | ||
| BigInt _readBytes(Uint8List bytes) { | ||
| BigInt read(int start, int end) { | ||
| if (end - start <= 4) { | ||
| var result = 0; | ||
| for (int i = end - 1; i >= start; i--) { | ||
| result = result * 256 + bytes[i]; | ||
| } | ||
| return BigInt.from(result); | ||
| } | ||
| final mid = start + ((end - start) >> 1); | ||
| return read(start, mid) + | ||
| read(mid, end) * (BigInt.one << ((mid - start) * 8)); | ||
| } | ||
|
|
||
| return read(0, bytes.length); | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.