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

Function mint_revocation

atomic-canonical/src/delegation.rs:461–478  ·  view source on GitHub ↗

Mint a signed revocation. Revocation is a signed document rather than a bare API call so that it replicates, audits and verifies like everything else — and so a revocation issued offline is still provable when it reaches a server later.

(
    delegator: &Identity,
    delegator_key: &KeyPair,
    delegation: &DelegationId,
    reason: Option<&str>,
)

Source from the content-addressed store, hash-verified

459/// replicates, audits and verifies like everything else — and so a revocation
460/// issued offline is still provable when it reaches a server later.
461pub fn mint_revocation(
462 delegator: &Identity,
463 delegator_key: &KeyPair,
464 delegation: &DelegationId,
465 reason: Option<&str>,
466) -> Value {
467 let mut doc = Map::new();
468 doc.insert("@context".into(), json!(CONTEXT_URL));
469 doc.insert("@type".into(), json!(TYPE_REVOCATION));
470 doc.insert("delegation".into(), json!(delegation.to_urn()));
471 doc.insert("delegator".into(), json!(delegator.id.to_did()));
472 doc.insert("revokedAt".into(), json!(rfc3339(Utc::now())));
473 if let Some(reason) = reason {
474 doc.insert("reason".into(), json!(reason));
475 }
476
477 proof::attest_value(Value::Object(doc), delegator, delegator_key)
478}
479
480/// Verify a revocation against the delegator's public key.
481///

Callers 4

executeMethod · 0.85
executeMethod · 0.85
revocation_round_tripsFunction · 0.85

Calls 2

attest_valueFunction · 0.85
insertMethod · 0.45

Tested by 2

revocation_round_tripsFunction · 0.68