[Feature] Add Electrum Seed Support to Seed XOR Flow, builds on PR #738#884
Open
berlinxray wants to merge 2 commits intoSeedSigner:devfrom
Open
[Feature] Add Electrum Seed Support to Seed XOR Flow, builds on PR #738#884berlinxray wants to merge 2 commits intoSeedSigner:devfrom
berlinxray wants to merge 2 commits intoSeedSigner:devfrom
Conversation
4 tasks
0b4ea79 to
2042a8f
Compare
Implement the Seed XOR split/combine workflow, enabling users to reconstruct a Bitcoin seed from multiple XOR shards. Based on PR SeedSigner#738 by @Advaitgaur004. - Add complete XOR rebuild UI: load shards, manage, finalize - Add word-index-based XOR combine in mnemonic_generation.py - Add SeedXORValidator for shard validation and inverse detection - Add FLOW__REBUILD_SEEDXOR controller methods and SeedStorage state - Add SETTING__SEED_XOR feature toggle - Add ScanSeedQRView support for XOR shard scanning - Uncomment CLOSE icon constant used by XOR views - Add 14 unit tests and flow integration tests Co-Authored-By: Advaitgaur004 <advaitgaur004@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable Electrum native segwit seeds to participate in XOR split/combine operations alongside standard BIP-39 seeds. - Replace entropy-based XOR with word-index-based approach in combine_mnemonics_with_xor() to support Electrum seeds (which lack valid BIP-39 checksums) - Add Seed.detect_mnemonic_type() to identify Electrum seeds after XOR recombination by checking all last-word checksum variants against HMAC-SHA512 prefix "100" - Add Seed.get_electrum_mnemonic() to recover the exact Electrum last word after BIP-39 checksum recomputation - Update RebuildSeedXORLoadShardView with Electrum seed entry option (gated by existing Electrum Seeds setting) - Update RebuildSeedXORFinalizeView to detect result type and create ElectrumSeed when appropriate, with warning when Electrum disabled - Fix SeedXORValidator to use ignore_checksum=True for Electrum seed compatibility in inverse-shard detection - Add 13 unit tests for Electrum XOR roundtrip, type detection, and validator compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2042a8f to
612c675
Compare
7 tasks
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
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.
Based on: PR #738 (Seed XOR functionality)
Related: PR #513 / #571 (Electrum seed support), Issue #43 (SeedXOR)
Summary
Builds on PR #738 (Seed XOR Flow by @Advaitgaur004) to add Electrum native segwit seed support to the XOR split/combine workflow.
Changes (13 files)
Core (
src/seedsigner/helpers/mnemonic_generation.py)bip39.mnemonic_to_bytes) with word-index-based approach — Electrum seeds lack valid BIP-39 checksums, so direct entropy extraction fails. Word-index XOR operates on the raw 11-bit indices and reconstructs entropy bits afterwards.Model (
src/seedsigner/models/seed.py)Seed._is_electrum_hmac()— HMAC-SHA512 prefix check for segwit ("100") only. The standard prefix ("01") is excluded to prevent false positives during 256-variant brute-force on 24-word seeds.Seed.detect_mnemonic_type()— Checks all 16/256 last-word checksum variants for Electrum HMAC matchSeed.get_electrum_mnemonic()— Recovers the exact last word that makes the mnemonic a valid Electrum seedValidator (
src/seedsigner/helpers/seed_xor_validator.py)ignore_checksum=Truein inverse-shard detection so Electrum seeds don't trigger checksum errorsController (
src/seedsigner/controller.py)FLOW__REBUILD_SEEDXORconstant and XOR rebuild methods:validate_rebuild_seedxor_shard(),process_rebuild_seedxor_shard(),remove_rebuild_seedxor_shard(),clear_rebuild_seedxor_data()Storage (
src/seedsigner/models/seed_storage.py)rebuild_seedxor_shards,rebuild_seedxor_combined_seed, and management methodsSettings (
src/seedsigner/models/settings_definition.py)SETTING__SEED_XORfeature toggle (advanced, enabled by default)GUI (
src/seedsigner/gui/components.py)CLOSEicon constant used by Seed XOR viewsViews (
src/seedsigner/views/seed_views.py)RebuildSeedXORLoadShardView,RebuildSeedXORManageView,RebuildSeedXORShowFingerprintView,RebuildSeedXORFinalizeView,RebuildSeedXORFinalizeOptionsView, and moreSETTING__ELECTRUM_SEEDSElectrumSeedwhen appropriateScan Views (
src/seedsigner/views/scan_views.py)ScanSeedQRViewacceptsis_rebuild_seedxor_shardparameter to route scanned seeds into the XOR flowTests
tests/test_seedxor.py: 14 tests for base XOR logic (combine, commutativity, identity, invalid words, mismatched lengths)tests/test_seedxor_electrum.py: 13 tests (roundtrip, type detection, commutativity, validator acceptance, derivation path preservation)tests/test_flow_seedxor.py: Integration tests for XOR rebuild UI workflowChecklist
pytestpassesTest plan