Create a delegation ID from the delegation data.
(
delegator_id: &IdentityId,
delegate_id: &IdentityId,
created_at: DateTime<Utc>,
)
| 428 | impl DelegationId { |
| 429 | /// Create a delegation ID from the delegation data. |
| 430 | pub fn from_delegation_data( |
| 431 | delegator_id: &IdentityId, |
| 432 | delegate_id: &IdentityId, |
| 433 | created_at: DateTime<Utc>, |
| 434 | ) -> Self { |
| 435 | let mut hasher = blake3::Hasher::new(); |
| 436 | hasher.update(delegator_id.as_bytes()); |
| 437 | hasher.update(delegate_id.as_bytes()); |
| 438 | hasher.update(&created_at.timestamp().to_le_bytes()); |
| 439 | DelegationId(*hasher.finalize().as_bytes()) |
| 440 | } |
| 441 | |
| 442 | /// Create a delegation ID from raw bytes. |
| 443 | pub fn from_bytes(bytes: [u8; 32]) -> Self { |
nothing calls this directly
no test coverage detected