Bump the delegator's epoch: everything they have issued, to anyone, dies. There is nothing to sign per-grant here and nothing to record locally, because the whole point is to reach grants this machine has never seen. It is purely a server-side statement about time, so unlike a targeted revocation it is useless offline — and says so rather than pretending.
(&self, store: &IdentityStore)
| 560 | /// It is purely a server-side statement about time, so unlike a targeted |
| 561 | /// revocation it is useless offline — and says so rather than pretending. |
| 562 | async fn revoke_everything(&self, store: &IdentityStore) -> CliResult<()> { |
| 563 | if self.local { |
| 564 | return Err(CliError::InvalidArgument { |
| 565 | message: "--all-mine cannot be done locally: it is a statement the server \ |
| 566 | makes about every grant you have issued, including ones this \ |
| 567 | machine has never seen." |
| 568 | .to_string(), |
| 569 | }); |
| 570 | } |
| 571 | |
| 572 | let delegator = super::load_identity_or_default(store, None)?; |
| 573 | let (client, url) = |
| 574 | crate::commands::client::build_apex_client_as(&delegator, self.server.as_deref()) |
| 575 | .await?; |
| 576 | |
| 577 | let result = client |
| 578 | .set_delegator_epoch() |
| 579 | .await |
| 580 | .map_err(|e| CliError::RemoteError { |
| 581 | message: format!("Could not set the epoch: {e}"), |
| 582 | url: Some(url.clone()), |
| 583 | })?; |
| 584 | |
| 585 | print_success(&format!( |
| 586 | "Every grant issued by '{}' is now invalid at {url}", |
| 587 | delegator.name |
| 588 | )); |
| 589 | if let Some(at) = result.delegations_valid_from { |
| 590 | println!(" Epoch {}", at.format("%Y-%m-%d %H:%M:%S UTC")); |
| 591 | } |
| 592 | println!(); |
| 593 | print_hint( |
| 594 | "Your agents will stop working until you issue fresh grants: \ |
| 595 | atomic identity grant new <agent>", |
| 596 | ); |
| 597 | |
| 598 | Ok(()) |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | // --------------------------------------------------------------------------- |
no test coverage detected