pub struct ValidatedGrants(/* private fields */);Expand description
Owned canonical grants admitted to the portable limits once, before use. This establishes shape only, never enrollment, provenance or authorization. Hosts must select the current protected set and advance their generation atomically with authority changes. Clock, revocation and scope checks still run for every operation. Construct a fresh value after decoding configuration or restoring it from storage; this type has no unchecked deserializer.
Read access cannot invalidate admitted ordering or grammar:
use ic_auth::portable::ValidatedGrants;
fn change(grants: &mut ValidatedGrants) {
grants.as_slice()[0].scopes.clear();
}Implementations§
Source§impl ValidatedGrants
impl ValidatedGrants
Sourcepub fn new(
grants: Vec<DelegatedRoleGrant>,
) -> Result<Self, GrantValidationError>
pub fn new( grants: Vec<DelegatedRoleGrant>, ) -> Result<Self, GrantValidationError>
Admit nonempty, strictly ordered role/scope grants without normalization. Refuse more than 16 roles or 32 scopes per role, empty scope sets and invalid scope labels through the canonical grant validator.
pub fn as_slice(&self) -> &[DelegatedRoleGrant]
Sourcepub fn into_vec(self) -> Vec<DelegatedRoleGrant>
pub fn into_vec(self) -> Vec<DelegatedRoleGrant>
Consume structural evidence before editing or projecting the raw grants.
Reconstruct through new before using edited grants as authority again.