MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / revoke_everything

Method revoke_everything

atomic-cli/src/commands/identity/delegation.rs:563–600  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

executeMethod · 0.80

Calls 6

load_identity_or_defaultFunction · 0.85
build_apex_client_asFunction · 0.85
print_successFunction · 0.85
print_hintFunction · 0.85
set_delegator_epochMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected