Add BRC-157 entropy backups to BSVCompat - #7
Merged
Conversation
Contributor
Author
|
Independent standards pass against |
rohenaz
force-pushed
the
codex/brc157-entropy
branch
from
August 31, 2026 04:36
f0a3508 to
b9407cb
Compare
rohenaz
marked this pull request as ready for review
August 31, 2026 04:45
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.
Summary
BRC157Entropyto opt-inBSVCompat, where the SDK's BIP-39/BIP-32 primitives already livem/0'/i', with profile zero atm/0'/0'This belongs in the SDK rather than
ToolboxWallet: BRC-157 composes reusable BIP-39, BIP-32, secp256k1, and BRC-140 primitives and has no concrete wallet/storage behavior.BRC-140 alignment
Review found two pre-existing deviations in the Swift BRC-140 helper, corrected here because BRC-157 relies on it:
Local TypeScript and Go source use the same first-threshold recovery semantics. Their retry loops perform one unused sixth draw before throwing but never accept it; Swift stops after the normative fifth failure.
Entropy-length safety
Imported 12/15/18/21-word entropy is left-padded for BRC-140. Exact restoration therefore requires trusted, authenticated
entropyByteCountmetadata. Too-small lengths that discard nonzero bytes are rejected, but a too-large supported length can absorb genuine zero padding and produce a different valid mnemonic/root. The API and README state this explicitly; wallet restore must also verify the expected identity key.Verification
git diff --checkThe live Go oracle could not launch because the local Go 1.25 toolchain verification fails while
GOSUMDB=off; static Go/TypeScript reference comparison and all local tests completed.