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>,
)
| 459 | /// replicates, audits and verifies like everything else — and so a revocation |
| 460 | /// issued offline is still provable when it reaches a server later. |
| 461 | pub 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 | /// |