Add forget all certificates & poll to client CLI#10017
Conversation
AureliaDolo
left a comment
There was a problem hiding this comment.
A few nits but otherwise LGTM
| println!("You are about to clear the local certificates database for device:"); | ||
| println!("{YELLOW}{short_id}{RESET} - {organization_id}: {human_handle} @ {device_label}"); | ||
| println!("Are you sure? (y/n)"); |
There was a problem hiding this comment.
If you want to be shinny, you can use the Confirm prompt from dialogue like here
There was a problem hiding this comment.
I'm all okay for additional shininess, though I'd rather not do this change in this PR
This is because I've copied this code from another command, so it should also be modified
So I've opened issue #10020
| crate::build_main_with_client!(main, poll); | ||
|
|
||
| pub async fn poll(_args: Args, client: &StartedClient) -> anyhow::Result<()> { | ||
| let mut spinner = start_spinner("Poll server for new certificates".into()); |
There was a problem hiding this comment.
I used it initially, however this helper doesn't display the number of new certificates
I think not showing the number of new certificates is fine when the poll is a side task, but for this CLI command it is the main thing so reporting is a good thing
There was a problem hiding this comment.
The function could easily updated to return the number of certificate
| &self, | ||
| latest_known_timestamps: Option<&PerTopicLastTimestamps>, | ||
| ) -> Result<(), CertifPollServerError> { | ||
| ) -> Result<usize, CertifPollServerError> { |
There was a problem hiding this comment.
returns the number of new certificates
I've added a comment (there was already one for Client::poll_server_for_new_certificates but not for CertficateOps::poll_server_for_new_certificates
| let alice = env.local_device("alice@dev1"); | ||
| let ops = certificates_ops_factory(env, &alice).await; | ||
|
|
||
| let add_first_certifcate = async || { |
There was a problem hiding this comment.
| let add_first_certifcate = async || { | |
| let add_first_certificate = async || { |
709182a to
5111633
Compare
5111633 to
1e5b8d5
Compare
| return { ok: true, value: null }; | ||
| return { | ||
| ok: true, | ||
| // @ts-ignore: Too cumbersome to create a full `AvailableDevice` object, |
There was a problem hiding this comment.
You can just c/c from
It may be easier than trying to trick the linter.This code will be gone very soon anyway.
FirelightFlagboy
left a comment
There was a problem hiding this comment.
Missing newsfragment
1e5b8d5 to
871bd18
Compare
|
@FirelightFlagboy I've added the newsfragment 🙏 |
871bd18 to
848bd0a
Compare
| #[clap(long, short, action)] | ||
| password: bool, | ||
| #[clap(long, short, action)] | ||
| keyring: bool, |
There was a problem hiding this comment.
suggestion (blocking): Use a enum instead that simply the pattern matching
There was a problem hiding this comment.
I've created issue #10028 to track this, since we want to also standardize the other CLI commands
848bd0a to
8f6fe3a
Compare
8f6fe3a to
debeeee
Compare
|
@FirelightFlagboy I've added a test for each new CLI command (and I found an error in the naming of a command thank this them ^^) |
|
|
||
| #[rstest::rstest] | ||
| #[tokio::test] | ||
| async fn ok(tmp_path: TmpPath) { |
There was a problem hiding this comment.
issue (blocking): The test is not complete, we need to check if the device can be unlocked with the new authentication
|
|
||
| #[rstest::rstest] | ||
| #[tokio::test] | ||
| async fn ok(tmp_path: TmpPath) { |
There was a problem hiding this comment.
todo: Add a todo comment about inspecting the info of the device via device info (command not exiting for now)
bd0cf68 to
2f543ca
Compare
2f543ca to
d432b0d
Compare
d432b0d to
0f11f1e
Compare
…new certificates fetched
…ds to the client CLI
…ice_change_authentication` and add `update_device_overwrite_server_addr`
…ange_authentication` & `update_device_overwrite_organization_addr`
…write-server-url`
… by `libparsec.updateDeviceChangeAuthentication`
0f11f1e to
f650a0b
Compare
No description provided.