Skip to content

Commit 5e44dcb

Browse files
codexBenWestgate
authored andcommitted
cli: Announce recovery secret switch
Entering a complete valid secret during interactive share recovery intentionally supersedes the partial share set. Previously that mode switch happened silently, which made correct behavior look like discarded input. Emit one explicit notice only when shares were already accepted, and pin the behavior in the existing interactive recovery regression. Refs #38
1 parent b2aafde commit 5e44dcb

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/codex32/_cli_input.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ def allowed(candidate: CorrectionCandidate) -> bool:
805805
if one:
806806
return [artifact]
807807
if isinstance(artifact, Secret) and not basis:
808+
if accepted:
809+
_stderr("Complete secret supplied; using it instead of the accepted shares.")
808810
return [artifact]
809811
if not accepted:
810812
required = artifact.header.threshold

‎tests/test_cli.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ def answer(prompt: str) -> str:
11551155
assert "Rejected:" not in captured.err
11561156
assert "Share 1 of 3 accepted." in captured.err
11571157
assert "Share 2 of 3 accepted." in captured.err
1158+
assert "Complete secret supplied; using it instead of the accepted shares." in captured.err
11581159
first_prompt = (
11591160
"Enter a codex32 string:\n> " if command[0] == "secret" else "Enter a codex32 string:\n> MS1"
11601161
)

0 commit comments

Comments
 (0)