Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] shared recovery invitation #9232

Merged
merged 5 commits into from
Jan 15, 2025
Merged

Conversation

AureliaDolo
Copy link
Contributor

Fix #9180

@AureliaDolo AureliaDolo force-pushed the aurelia/cli/invit/shared-recovery branch from ed656aa to 28dfa32 Compare December 19, 2024 18:08
@AureliaDolo AureliaDolo changed the title Aurelia/cli/invit/shared recovery [CLI] shared recovery invitation Dec 20, 2024
@AureliaDolo AureliaDolo force-pushed the aurelia/cli/invit/shared-recovery branch 2 times, most recently from f406ad7 to 820b8f3 Compare December 20, 2024 16:17
@AureliaDolo AureliaDolo marked this pull request as ready for review January 9, 2025 08:38
@AureliaDolo AureliaDolo requested a review from a team as a code owner January 9, 2025 08:38
@AureliaDolo AureliaDolo force-pushed the aurelia/cli/invit/shared-recovery branch from 81d10b2 to 5f75424 Compare January 9, 2025 08:40
cli/src/commands/invite/claim.rs Show resolved Hide resolved
libparsec/crates/client/src/invite/claimer.rs Outdated Show resolved Hide resolved
cli/src/commands/invite/claim.rs Show resolved Hide resolved
cli/src/commands/invite/claim.rs Outdated Show resolved Hide resolved
cli/src/commands/invite/claim.rs Outdated Show resolved Hide resolved
cli/src/commands/invite/claim.rs Outdated Show resolved Hide resolved
cli/src/commands/invite/greet.rs Outdated Show resolved Hide resolved
@AureliaDolo AureliaDolo force-pushed the aurelia/cli/invit/shared-recovery branch 2 times, most recently from b41fb88 to 0c36db4 Compare January 13, 2025 14:52
}
};

let final_ctx = loop {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the server is offline and the user keep retrying it could go forever :/

@FirelightFlagboy
Copy link
Contributor

I do not see a newsfragment, that expected?

@AureliaDolo AureliaDolo force-pushed the aurelia/cli/invit/shared-recovery branch from 0c36db4 to 7801005 Compare January 13, 2025 15:58
@@ -0,0 +1 @@
[CLI] Implement invite claim and greet for shared recovery.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those newsfragments are meant to be user oriented. I think we should have only one of them for the whole #6090 meta-issue, introducing the shared recovery feature in general

@AureliaDolo AureliaDolo enabled auto-merge January 15, 2025 10:52
@AureliaDolo AureliaDolo added this pull request to the merge queue Jan 15, 2025
Merged via the queue into master with commit eb40365 Jan 15, 2025
14 checks passed
@AureliaDolo AureliaDolo deleted the aurelia/cli/invit/shared-recovery branch January 15, 2025 11:20
@@ -214,6 +346,34 @@ async fn step4_device(ctx: DeviceClaimInProgress3Ctx) -> anyhow::Result<DeviceCl
Ok(ctx)
}

/// Step 4: retrieve device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retrieve share

Comment on lines +159 to +163
let selection = Select::new()
.default(0)
.with_prompt("Choose a person to contact now")
.items(&human_recipients)
.interact()?;
Copy link
Contributor

@vxgmichel vxgmichel Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we ask the user to pick the next recipient but we do not display the current progress (like 2 out of 3 shares already retrieved). Also, we don't show how the number of shares owned by each recipient.

For reference, see the v2 interaction:

async def _choose_recipient(
prelude_ctx: ShamirRecoveryClaimPreludeCtx,
) -> ShamirRecoveryRecipient:
styled_current_shares = click.style(len(prelude_ctx.shares), fg="yellow")
styled_threshold = click.style(prelude_ctx.threshold, fg="yellow")
if len(prelude_ctx.shares) == 0:
click.echo(f"A total of {styled_threshold} shares are necessary to recover the device.")
elif len(prelude_ctx.shares) == 1:
click.echo(
f"Out of the {styled_threshold} necessary shares, {styled_current_shares} share has been retrieved so far."
)
else:
click.echo(
f"Out of the {styled_threshold} necessary shares, {styled_current_shares} shares have been retrieved so far."
)
for i, recipient in enumerate(prelude_ctx.remaining_recipients):
assert recipient.human_handle is not None
styled_human_handle = click.style(recipient.human_handle.str, fg="yellow")
styled_share_number = click.style(recipient.shares, fg="yellow")
styled_share_number = (
f"{styled_share_number} share"
if recipient.shares == 1
else f"{styled_share_number} shares"
)
click.echo(f" {i} - {styled_human_handle} ({styled_share_number})")
choices = [str(x) for x in range(len(prelude_ctx.recipients))]
choice_index = await async_prompt("Next user to contact", type=click.Choice(choices))
return prelude_ctx.recipients[int(choice_index)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CLI] Implement shared recovery invitation process
3 participants