pub struct ConsentRecord {
pub id: String,
pub subject: String,
pub recipient: String,
pub data_elements: Vec<String>,
pub purpose: String,
pub timestamp: String,
pub expires: Option<String>,
pub status: ConsentStatus,
}Expand description
A consent record tracking what data was shared, with whom, and when.
Fields§
§id: StringUnique identifier for this consent record.
subject: StringWho gave consent (holder DID).
recipient: StringWho received the data (verifier DID or identifier).
data_elements: Vec<String>What data elements were shared.
purpose: StringPurpose of sharing (PCTF requires explicit purpose limitation).
timestamp: StringWhen consent was given (RFC 3339).
expires: Option<String>When consent expires (RFC 3339), if limited.
status: ConsentStatusCurrent status of this consent.
Implementations§
Source§impl ConsentRecord
impl ConsentRecord
Sourcepub fn new(
id: impl Into<String>,
subject: impl Into<String>,
recipient: impl Into<String>,
data_elements: Vec<String>,
purpose: impl Into<String>,
timestamp: impl Into<String>,
expires: Option<String>,
) -> Self
pub fn new( id: impl Into<String>, subject: impl Into<String>, recipient: impl Into<String>, data_elements: Vec<String>, purpose: impl Into<String>, timestamp: impl Into<String>, expires: Option<String>, ) -> Self
Create a new active consent record.
Sourcepub fn is_valid(&self, now: &str) -> bool
pub fn is_valid(&self, now: &str) -> bool
Check if the consent is currently valid (active and not expired).
now should be an RFC 3339 timestamp for the current time.
Sourcepub fn check_expiry(&mut self, now: &str)
pub fn check_expiry(&mut self, now: &str)
Check expiry and update status if expired.
Trait Implementations§
Source§impl Clone for ConsentRecord
impl Clone for ConsentRecord
Source§fn clone(&self) -> ConsentRecord
fn clone(&self) -> ConsentRecord
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 ConsentRecord
impl Debug for ConsentRecord
Source§impl<'de> Deserialize<'de> for ConsentRecord
impl<'de> Deserialize<'de> for ConsentRecord
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 ConsentRecord
impl RefUnwindSafe for ConsentRecord
impl Send for ConsentRecord
impl Sync for ConsentRecord
impl Unpin for ConsentRecord
impl UnwindSafe for ConsentRecord
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