Derive the deterministic id for a delegation's defining triple. Deterministic so a verifier can recompute it from the certificate body and confirm the `@id` was not swapped — the id is a claim like any other, and the only claims worth trusting are the ones you can recheck.
(
delegator_id: &IdentityId,
delegate_id: &IdentityId,
created_at: DateTime<Utc>,
)
| 582 | /// and confirm the `@id` was not swapped — the id is a claim like any |
| 583 | /// other, and the only claims worth trusting are the ones you can recheck. |
| 584 | pub fn from_delegation_data( |
| 585 | delegator_id: &IdentityId, |
| 586 | delegate_id: &IdentityId, |
| 587 | created_at: DateTime<Utc>, |
| 588 | ) -> Self { |
| 589 | let mut hasher = blake3::Hasher::new(); |
| 590 | hasher.update(b"atomic:delegation:v1"); |
| 591 | hasher.update(delegator_id.as_bytes()); |
| 592 | hasher.update(delegate_id.as_bytes()); |
| 593 | hasher.update(&created_at.timestamp().to_le_bytes()); |
| 594 | Self(*hasher.finalize().as_bytes()) |
| 595 | } |
| 596 | |
| 597 | /// Wrap raw bytes. |
| 598 | pub fn from_bytes(bytes: [u8; 32]) -> Self { |
nothing calls this directly
no test coverage detected