pub struct ConsentGrant {
pub grant_id: [u8; 32],
pub principal_did: [u8; 32],
pub recipient_did: [u8; 32],
pub scope: ConsentScope,
pub purpose_hash: u64,
pub created_at: u64,
pub expires_at: u64,
pub nonce: u64,
pub signature: [u8; 64],
}Expand description
A time-bounded, category-scoped cryptographic consent grant.
Fields§
§grant_id: [u8; 32]§principal_did: [u8; 32]§recipient_did: [u8; 32]§scope: ConsentScope§purpose_hash: u64§created_at: u64§expires_at: u64§nonce: u64§signature: [u8; 64]Implementations§
Source§impl ConsentGrant
impl ConsentGrant
Sourcepub fn compute_digest(&self) -> [u8; 32]
pub fn compute_digest(&self) -> [u8; 32]
Compute the immutable canonical digest of the grant payload.
Sourcepub fn new_signed(
grant_id: [u8; 32],
principal_signing_key: &SigningKey,
recipient_did: [u8; 32],
scope: ConsentScope,
purpose_hash: u64,
created_at: u64,
expires_at: u64,
nonce: u64,
) -> Self
pub fn new_signed( grant_id: [u8; 32], principal_signing_key: &SigningKey, recipient_did: [u8; 32], scope: ConsentScope, purpose_hash: u64, created_at: u64, expires_at: u64, nonce: u64, ) -> Self
Sign and construct a new consent grant.
Sourcepub fn verify(&self, now: u64) -> Result<(), ConsentError>
pub fn verify(&self, now: u64) -> Result<(), ConsentError>
Verify signature and temporal validity. Expiry fails closed.
Sourcepub fn to_deontic_quin(&self, category_flag: u32) -> NQuin
pub fn to_deontic_quin(&self, category_flag: u32) -> NQuin
Convert grant into an OP_PERMIT Deontic Super-Quin.
Trait Implementations§
Source§impl Clone for ConsentGrant
impl Clone for ConsentGrant
Source§impl Debug for ConsentGrant
impl Debug for ConsentGrant
Source§impl<'de> Deserialize<'de> for ConsentGrant
impl<'de> Deserialize<'de> for ConsentGrant
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
impl Eq for ConsentGrant
Source§impl PartialEq for ConsentGrant
impl PartialEq for ConsentGrant
Source§impl Serialize for ConsentGrant
impl Serialize for ConsentGrant
impl StructuralPartialEq for ConsentGrant
Auto Trait Implementations§
impl Freeze for ConsentGrant
impl RefUnwindSafe for ConsentGrant
impl Send for ConsentGrant
impl Sync for ConsentGrant
impl Unpin for ConsentGrant
impl UnsafeUnpin for ConsentGrant
impl UnwindSafe for ConsentGrant
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
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
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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