Skip to content

Commit cebecfc

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 aa2d333 commit cebecfc

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
@@ -804,6 +804,8 @@ def allowed(candidate: CorrectionCandidate) -> bool:
804804
if one:
805805
return [artifact]
806806
if isinstance(artifact, Secret) and not basis:
807+
if accepted:
808+
_stderr("Complete secret supplied; using it instead of the accepted shares.")
807809
return [artifact]
808810
if not accepted:
809811
required = artifact.header.threshold

‎tests/test_cli.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,7 @@ def answer(prompt: str) -> str:
10941094
assert "Rejected:" not in captured.err
10951095
assert "Share 1 of 3 accepted." in captured.err
10961096
assert "Share 2 of 3 accepted." in captured.err
1097+
assert "Complete secret supplied; using it instead of the accepted shares." in captured.err
10971098
first_prompt = (
10981099
"Enter a codex32 string:\n> " if command[0] == "secret" else "Enter a codex32 string:\n> MS1"
10991100
)

0 commit comments

Comments
 (0)