fix: reject single-share Shamir splits#60
Open
slashdevcorpse wants to merge 1 commit into
Open
Conversation
Threshold-1 splits generate shares that expose the raw secret but cannot be restored through the existing recovery path, which rejects fewer than two points. Reject the split up front so callers do not create unusable mnemonic share sets. Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
Pull request overview
This PR prevents creation of unrecoverable Shamir share sets by rejecting threshold-1 splits at split time, aligning behavior with the existing restore path (which requires at least two points).
Changes:
- Add an explicit
threshold < 2guard in__split_secret. - Update mnemonic splitting tests to expect failure for
threshold=1instead of producing shares. - Add a test asserting raw secret splitting rejects
threshold=1.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/jsbtc.test.js |
Updates/extends tests to assert threshold-1 splits throw "Minimum 2 shares required". |
src/functions/shamir_secret_sharing.js |
Adds a runtime guard rejecting threshold < 2 in __split_secret. |
Files not reviewed (1)
- test/jsbtc.test.js: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Validation
npm testgit diff --checkBounty payout address if accepted:
bc1qssrlr7qu0kq2kmf7arwznpuad0aw5wr9ls7c3q