pub struct UcanPayload {
pub issuer: Did,
pub audience: Did,
pub capabilities: Vec<Capability>,
pub not_before: Option<u64>,
pub expiration: Option<u64>,
pub nonce: Vec<u8>,
}Expand description
The signed body of a UCAN: everything an issuer commits to with their
signature. Serialized to canonical CBOR (UcanPayload::signing_bytes) to
produce the exact bytes the hybrid-COSE composite signs/verifies.
Fields§
§issuer: DidThe issuer (signer) DID.
audience: DidThe audience (delegate) DID — who this UCAN grants authority to.
capabilities: Vec<Capability>The capabilities granted by this UCAN.
not_before: Option<u64>not before — earliest unix second at which this UCAN is valid.
expiration: Option<u64>expiration — unix second after which this UCAN is invalid. None =
non-expiring (discouraged but representable).
nonce: Vec<u8>Replay-uniqueness nonce.
Implementations§
Source§impl UcanPayload
impl UcanPayload
Sourcepub fn signing_bytes(&self) -> Result<Vec<u8>, UcanError>
pub fn signing_bytes(&self) -> Result<Vec<u8>, UcanError>
Canonical CBOR bytes of the payload — the exact bytes that are signed and verified. Deterministic for a given payload (ciborium emits map keys in struct-field order; the same payload always yields identical bytes), so a signature over these bytes is stable across processes.
Serializing an in-memory payload into a Vec is infallible for this
shape; we still avoid unwrap/expect in non-test code and surface any
(unreachable) encoder error as a fail-closed UcanError.
Trait Implementations§
Source§impl Clone for UcanPayload
impl Clone for UcanPayload
Source§fn clone(&self) -> UcanPayload
fn clone(&self) -> UcanPayload
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 UcanPayload
impl Debug for UcanPayload
Source§impl<'de> Deserialize<'de> for UcanPayload
impl<'de> Deserialize<'de> for UcanPayload
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 UcanPayload
impl PartialEq for UcanPayload
Source§fn eq(&self, other: &UcanPayload) -> bool
fn eq(&self, other: &UcanPayload) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for UcanPayload
impl Serialize for UcanPayload
impl Eq for UcanPayload
impl StructuralPartialEq for UcanPayload
Auto Trait Implementations§
impl Freeze for UcanPayload
impl RefUnwindSafe for UcanPayload
impl Send for UcanPayload
impl Sync for UcanPayload
impl Unpin for UcanPayload
impl UnsafeUnpin for UcanPayload
impl UnwindSafe for UcanPayload
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