pub struct ApprovalBinding {
pub ucan_cid: [u8; 32],
pub generation: u64,
pub bundle_hash: [u8; 32],
}Expand description
The reviewed binding: the approved UCAN’s CID, the lattice generation it is
valid for, and the hash of the bundle it compiles to. These are the bytes the
hybrid-COSE signature covers (see ApprovalBinding::signing_payload).
bundle_hash is intentionally a raw [u8; 32] — the exact type S4’s
CompiledPolicy::policy_hash() returns — so milestone-2 bundle emission feeds
its output straight in with no conversion, and a verified binding yields an
S4 compiled::PolicyApproval { generation, approved_hash: bundle_hash }.
Fields§
§ucan_cid: [u8; 32]BLAKE3 CID of the approved UCAN (ucan_cid).
generation: u64The lattice/policy generation this bundle is valid for
([LatticeVersion::generation]). Bound so the approval cannot be replayed
under a different compartment vocabulary.
bundle_hash: [u8; 32]BLAKE3 hash of the compiled bundle (== S4 CompiledPolicy::policy_hash()).
Implementations§
Source§impl ApprovalBinding
impl ApprovalBinding
Sourcepub fn new(
ucan: &Ucan,
generation: u64,
bundle_hash: [u8; 32],
) -> Result<Self, ApprovalError>
pub fn new( ucan: &Ucan, generation: u64, bundle_hash: [u8; 32], ) -> Result<Self, ApprovalError>
Construct a binding from an approved UCAN, the generation it targets, and the hash of the bundle it compiled to.
Sourcepub fn signing_payload(&self) -> Vec<u8> ⓘ
pub fn signing_payload(&self) -> Vec<u8> ⓘ
The exact, domain-separated bytes the signature covers:
b"hs-mac-ucan-approval" || ucan_cid || generation_be || bundle_hash.
Deterministic and length-prefixed by fixed field widths, so the layout is
unambiguous.
Trait Implementations§
Source§impl Clone for ApprovalBinding
impl Clone for ApprovalBinding
Source§fn clone(&self) -> ApprovalBinding
fn clone(&self) -> ApprovalBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ApprovalBinding
impl Debug for ApprovalBinding
Source§impl<'de> Deserialize<'de> for ApprovalBinding
impl<'de> Deserialize<'de> for ApprovalBinding
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ApprovalBinding
impl PartialEq for ApprovalBinding
Source§fn eq(&self, other: &ApprovalBinding) -> bool
fn eq(&self, other: &ApprovalBinding) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ApprovalBinding
impl Serialize for ApprovalBinding
impl Eq for ApprovalBinding
impl StructuralPartialEq for ApprovalBinding
Auto Trait Implementations§
impl Freeze for ApprovalBinding
impl RefUnwindSafe for ApprovalBinding
impl Send for ApprovalBinding
impl Sync for ApprovalBinding
impl Unpin for ApprovalBinding
impl UnsafeUnpin for ApprovalBinding
impl UnwindSafe for ApprovalBinding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more