pub struct TibetToken {
pub token_id: String,
pub parent_id: Option<String>,
pub timestamp: DateTime<Utc>,
pub erin: ContentHash,
pub eraan: Vec<String>,
pub eromheen: Eromheen,
pub erachter: String,
pub signature: Option<Vec<u8>>,
}Expand description
TIBET provenance token — who did what, when, why
Fields§
§token_id: String§parent_id: Option<String>§timestamp: DateTime<Utc>§erin: ContentHash§eraan: Vec<String>§eromheen: Eromheen§erachter: String§signature: Option<Vec<u8>>Implementations§
Source§impl TibetToken
impl TibetToken
pub fn new( erin: ContentHash, erachter: impl Into<String>, actor: impl Into<String>, jis_level: u8, ) -> Self
pub fn with_parent(self, parent_id: impl Into<String>) -> Self
pub fn with_access_stats(self, accessed: usize, denied: usize) -> Self
pub fn with_airlock_time(self, ms: f64) -> Self
Sourcepub fn signable_bytes(&self) -> Vec<u8> ⓘ
pub fn signable_bytes(&self) -> Vec<u8> ⓘ
Serialize the signable portion (everything except signature)
Sourcepub fn sign(self, keypair: &KeyPair) -> Self
pub fn sign(self, keypair: &KeyPair) -> Self
Sign this token with an Ed25519 keypair. Sets the signature field in-place and returns a reference to self.
Sourcepub fn verify_signature(&self, keypair: &KeyPair) -> CortexResult<()>
pub fn verify_signature(&self, keypair: &KeyPair) -> CortexResult<()>
Verify this token’s Ed25519 signature against a public key. Returns Ok(()) if valid, Err if missing or invalid.
Trait Implementations§
Source§impl Clone for TibetToken
impl Clone for TibetToken
Source§fn clone(&self) -> TibetToken
fn clone(&self) -> TibetToken
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TibetToken
impl Debug for TibetToken
Source§impl<'de> Deserialize<'de> for TibetToken
impl<'de> Deserialize<'de> for TibetToken
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TibetToken
impl RefUnwindSafe for TibetToken
impl Send for TibetToken
impl Sync for TibetToken
impl Unpin for TibetToken
impl UnsafeUnpin for TibetToken
impl UnwindSafe for TibetToken
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
Mutably borrows from an owned value. Read more