Struct noosphere_core::data::LinkRecord
source · pub struct LinkRecord(/* private fields */);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 to_sphere_identity(&self) -> Did
pub fn to_sphere_identity(&self) -> Did
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 fn superceded_by(&self, other: &LinkRecord) -> bool
pub fn superceded_by(&self, other: &LinkRecord) -> bool
Returns a boolean indicating whether the other LinkRecord
is a newer record referring to the same identity.
Underlying Ucan expiry is used to compare. A record with
null expiry cannot supercede or be superceded.
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
) -> Result<(), Error>
pub async fn validate<'a>( &self, now_time: Option<u64>, did_parser: &mut DidParser ) -> Result<(), Error>
Validate the UCAN’s signature and timestamps
sourcepub async fn check_signature<'a>(
&self,
did_parser: &mut DidParser
) -> Result<(), Error>
pub async fn check_signature<'a>( &self, did_parser: &mut DidParser ) -> 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>>
pub fn expires_at(&self) -> &Option<u64>
pub fn not_before(&self) -> &Option<u64>
pub fn nonce(&self) -> &Option<String>
pub fn attenuation(&self) -> &Capabilities
capabilities()pub fn capabilities(&self) -> &Capabilities
pub fn facts(&self) -> &Option<BTreeMap<String, Value>>
pub fn version(&self) -> &str
pub fn to_cid(&self, hasher: Code) -> Result<Cid<64>, Error>
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 for LinkRecord
impl PartialEq 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.
source§impl Serialize for LinkRecord
impl Serialize for LinkRecord
source§impl TryBundle for LinkRecord
impl TryBundle for LinkRecord
fn extend_bundle<'life0, 'life1, 'life2, 'async_trait, S>( &'life0 self, bundle: &'life1 mut Bundle, store: &'life2 S ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
fn extend_bundle_with_cid<'life0, 'life1, 'life2, 'async_trait, S>( cid: &'life0 Cid, bundle: &'life1 mut Bundle, store: &'life2 S ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
fn bundle<'life0, 'life1, 'async_trait, S>( &'life0 self, store: &'life1 S ) -> Pin<Box<dyn Future<Output = Result<Bundle>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
fn bundle_with_cid<'life0, 'life1, 'async_trait, S>( cid: &'life0 Cid, store: &'life1 S ) -> Pin<Box<dyn Future<Output = Result<Bundle>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
source§impl TryFrom<&[u8]> for LinkRecord
impl TryFrom<&[u8]> for LinkRecord
source§impl TryFrom<&Jwt> for LinkRecord
impl TryFrom<&Jwt> for LinkRecord
source§impl TryFrom<&LinkRecord> for Jwt
impl TryFrom<&LinkRecord> for Jwt
source§impl TryFrom<Jwt> for LinkRecord
impl TryFrom<Jwt> for LinkRecord
source§impl TryFrom<LinkRecord> for Jwt
impl TryFrom<LinkRecord> for Jwt
source§impl TryFrom<String> for LinkRecord
impl TryFrom<String> for LinkRecord
impl Eq for LinkRecord
Auto Trait Implementations§
impl RefUnwindSafe for LinkRecord
impl Send for LinkRecord
impl Sync for LinkRecord
impl Unpin for LinkRecord
impl UnwindSafe for LinkRecord
Blanket Implementations§
source§impl<T> Base64Encode for Twhere
T: DagJson,
impl<T> Base64Encode for Twhere T: DagJson,
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> DagJson for Twhere
T: Serialize + DeserializeOwned,
impl<T> DagJson for Twhere T: Serialize + DeserializeOwned,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.