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

Method from_delegation_data

atomic-identity/src/delegation.rs:430–440  ·  view source on GitHub ↗

Create a delegation ID from the delegation data.

(
        delegator_id: &IdentityId,
        delegate_id: &IdentityId,
        created_at: DateTime<Utc>,
    )

Source from the content-addressed store, hash-verified

428impl 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 {

Callers

nothing calls this directly

Calls 6

DelegationIdClass · 0.85
updateMethod · 0.80
to_le_bytesMethod · 0.80
as_bytesMethod · 0.45
timestampMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected