Skip to main content

ic_auth_protocol_types/
common.rs

1//! Passive application authentication common contracts.
2//! Adapted from Canic; see docs/design/canic-source-review.md.
3
4use crate::{AudienceId, AuthRole, ScopeLabel};
5use serde::{Deserialize, Serialize};
6
7//
8// DelegationAudience
9//
10
11#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12pub enum DelegationAudience {
13    Fleet(AudienceId),
14}
15
16//
17// DelegatedRoleGrant
18//
19
20#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
21/// Checked labels only; grant count, strict ordering and authority remain
22/// engine/host policy. Serialized labels retain their exact text representation.
23pub struct DelegatedRoleGrant {
24    pub target: AuthRole,
25    pub scopes: Vec<ScopeLabel>,
26}
27
28//
29// AuthRequestMetadata
30//
31
32#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
33pub struct AuthRequestMetadata {
34    pub request_id: [u8; 32],
35    pub ttl_ns: u64,
36}