INNER CODE UNIT · Rust
derive
AChep/keyguard-app · commonAgent/src/lib.rs:198
pub fn derive(canonical_context: &[u8]) -> Result<Self, IdentityError> {
if canonical_context.is_empty() {
return Err(IdentityError::EmptyAuthorizationContext);
}
Ok(Self(derive_fingerprint(
CONTEXT_FINGERPRINT_DOMAIN,
b"verified-protocol-context",
canonical_context,
)))
}
/// Constructs a fingerprint from already validated canonical bytes.
#[must_use]
pub const fn from_bytes(bytes: [u8; PRINCIPAL_FINGERPRINT_LEN]) -> Self {
Self(bytes)
}