#[non_exhaustive]pub struct UserDelegation {
pub bound_to: PrincipalId,
pub camp_id: String,
pub issued_at: i64,
pub expires_at: i64,
pub user_signing_key: [u8; 32],
pub signature: [u8; 64],
}Expand description
A short-lived authorization signed by a user U that lets cheers bind a
camp principal to U at provision time.
The signed payload is the canonical byte serialization of every field
except signature itself (see signing_payload).
Construct via UserDelegation::new — the constructor enforces the
invariants the authority would otherwise reject downstream. Deserialization
runs those same checks via [RawUserDelegation], so a wire payload can’t
bypass them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bound_to: PrincipalIdThe user authorising the delegation. MUST have
kind = User.
camp_id: StringCamp identifier (the bare half of the to-be-minted camp:<id>).
Non-empty.
issued_at: i64Unix-second timestamp the user signed at.
expires_at: i64Unix-second timestamp the delegation stops being acceptable.
user_signing_key: [u8; 32]Ed25519 public key the signature must verify under (32 bytes). Wire form: base64url-no-pad string.
signature: [u8; 64]Ed25519 signature over signing_payload
(64 bytes). Wire form: base64url-no-pad string.
Implementations§
Source§impl UserDelegation
impl UserDelegation
Sourcepub fn new(
bound_to: PrincipalId,
camp_id: impl Into<String>,
issued_at: i64,
expires_at: i64,
user_signing_key: [u8; 32],
signature: [u8; 64],
) -> Result<Self, DelegationError>
pub fn new( bound_to: PrincipalId, camp_id: impl Into<String>, issued_at: i64, expires_at: i64, user_signing_key: [u8; 32], signature: [u8; 64], ) -> Result<Self, DelegationError>
Construct + validate. Rejects a non-user bound_to, an empty
camp_id, or an expires_at not strictly after issued_at.
Sourcepub fn is_expired_at(&self, now: i64) -> bool
pub fn is_expired_at(&self, now: i64) -> bool
true iff expires_at <= now — mirrors
McpClaims::is_expired_at.
Sourcepub fn signing_payload(&self) -> Vec<u8> ⓘ
pub fn signing_payload(&self) -> Vec<u8> ⓘ
Canonical bytes the user signed.
Stable across runs: a fixed-ordered struct of every field except the
signature itself, serialized through serde_json (which preserves
struct field order). Producers (the yah-side W122 signing flow) and
verifiers (cheers-server) MUST agree on this format byte-for-byte;
any change is a wire-contract change.
Trait Implementations§
Source§impl Clone for UserDelegation
impl Clone for UserDelegation
Source§fn clone(&self) -> UserDelegation
fn clone(&self) -> UserDelegation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more