Struct noosphere_core::data::LinkRecord
source · #[repr(transparent)]pub struct LinkRecord(_);Expand description
A LinkRecord is a wrapper around a decoded Jwt (Ucan), representing a link address as a Cid to a sphere.
Implementations§
source§impl LinkRecord
impl LinkRecord
sourcepub async fn validate<S: UcanJwtStore>(&self, store: &S) -> Result<()>
pub async fn validate<S: UcanJwtStore>(&self, store: &S) -> Result<()>
Validates the Ucan token as a LinkRecord, ensuring that
the sphere’s owner authorized the publishing of a new
content address. Notably does not check the publishing timeframe
permissions, as an expired token can be considered valid.
Returns an Err if validation fails.
sourcepub fn has_publishable_timeframe(&self) -> bool
pub fn has_publishable_timeframe(&self) -> bool
Returns true if the Ucan token is currently publishable within the bounds of its expiry/not before time.
sourcepub fn sphere_identity(&self) -> &str
pub fn sphere_identity(&self) -> &str
The DID key of the sphere that this record maps.
sourcepub fn get_link(&self) -> Option<Link<MemoIpld>>
pub fn get_link(&self) -> Option<Link<MemoIpld>>
The sphere revision address (Link
sourcepub async fn collect_proofs<S>(&self, store: &S) -> Result<Vec<Ucan>>where
S: UcanJwtStore,
pub async fn collect_proofs<S>(&self, store: &S) -> Result<Vec<Ucan>>where S: UcanJwtStore,
Walk the underlying Ucan and collect all of the supporting proofs that verify the link publisher’s authority to publish the link
Methods from Deref<Target = Ucan>§
sourcepub async fn validate<'a>(
&self,
now_time: Option<u64>,
did_parser: &mut DidParser
) -> impl Future<Output = Result<(), Error>>
pub async fn validate<'a>( &self, now_time: Option<u64>, did_parser: &mut DidParser ) -> impl Future<Output = Result<(), Error>>
Validate the UCAN’s signature and timestamps
sourcepub async fn check_signature<'a>(
&self,
did_parser: &mut DidParser
) -> impl Future<Output = Result<(), Error>>
pub async fn check_signature<'a>( &self, did_parser: &mut DidParser ) -> impl Future<Output = Result<(), Error>>
Validate that the signed data was signed by the stated issuer
sourcepub fn encode(&self) -> Result<String, Error>
pub fn encode(&self) -> Result<String, Error>
Produce a base64-encoded serialization of the UCAN suitable for transferring in a header field
sourcepub fn is_expired(&self, now_time: Option<u64>) -> bool
pub fn is_expired(&self, now_time: Option<u64>) -> bool
Returns true if the UCAN has past its expiration date
sourcepub fn signed_data(&self) -> &[u8] ⓘ
pub fn signed_data(&self) -> &[u8] ⓘ
Raw bytes of signed data for this UCAN
pub fn signature(&self) -> &[u8] ⓘ
sourcepub fn is_too_early(&self) -> bool
pub fn is_too_early(&self) -> bool
Returns true if the not-before (“nbf”) time is still in the future
sourcepub fn lifetime_begins_before(&self, other: &Ucan) -> bool
pub fn lifetime_begins_before(&self, other: &Ucan) -> bool
Returns true if this UCAN’s lifetime begins no later than the other Note that if a UCAN specifies an NBF but the other does not, the other has an unbounded start time and this function will return false.
sourcepub fn lifetime_ends_after(&self, other: &Ucan) -> bool
pub fn lifetime_ends_after(&self, other: &Ucan) -> bool
Returns true if this UCAN expires no earlier than the other
sourcepub fn lifetime_encompasses(&self, other: &Ucan) -> bool
pub fn lifetime_encompasses(&self, other: &Ucan) -> bool
Returns true if this UCAN’s lifetime fully encompasses the other
pub fn algorithm(&self) -> &str
pub fn issuer(&self) -> &str
pub fn audience(&self) -> &str
pub fn proofs(&self) -> &Option<Vec<String, Global>>
pub fn expires_at(&self) -> &u64
pub fn not_before(&self) -> &Option<u64>
pub fn nonce(&self) -> &Option<String>
pub fn attenuation(&self) -> &Vec<CapabilityIpld, Global>
pub fn facts(&self) -> &Option<Vec<Value, Global>>
pub fn version(&self) -> &str
Trait Implementations§
source§impl Clone for LinkRecord
impl Clone for LinkRecord
source§fn clone(&self) -> LinkRecord
fn clone(&self) -> LinkRecord
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for LinkRecord
impl Debug for LinkRecord
source§impl Deref for LinkRecord
impl Deref for LinkRecord
source§impl<'de> Deserialize<'de> for LinkRecord
impl<'de> Deserialize<'de> for LinkRecord
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 Display for LinkRecord
impl Display for LinkRecord
source§impl From<&LinkRecord> for Ucan
impl From<&LinkRecord> for Ucan
source§fn from(value: &LinkRecord) -> Self
fn from(value: &LinkRecord) -> Self
source§impl From<&Ucan> for LinkRecord
impl From<&Ucan> for LinkRecord
source§impl From<LinkRecord> for Ucan
impl From<LinkRecord> for Ucan
source§fn from(value: LinkRecord) -> Self
fn from(value: LinkRecord) -> Self
source§impl From<Ucan> for LinkRecord
impl From<Ucan> for LinkRecord
source§impl FromStr for LinkRecord
impl FromStr for LinkRecord
source§impl PartialEq<LinkRecord> for LinkRecord
impl PartialEq<LinkRecord> for LinkRecord
LinkRecords compare their Jwt representations for equality. If a record cannot be encoded as such, they will not be considered equal to any other record.