pub struct MessageVerification {
pub delegation: Delegation,
pub ttl_ms: u64,
pub ts_ms: u128,
pub sig: Vec<u8>,
}Expand description
Message Verification is based on session, and sig. it also included ttl time and created ts.
Fields§
§delegation: DelegationThe Delegation of the DelegateeKey. Used to identify a sender and verify the signature.
ttl_ms: u64The time to live of the message in milliseconds.
ts_ms: u128The timestamp of the message in milliseconds.
sig: Vec<u8>The signature of the message. Signed by DelegateeKey. Can be verified by Delegation.
Implementations§
Source§impl MessageVerification
impl MessageVerification
Sourcepub fn verify(&self, domain: SigningDomain, data: &[u8]) -> bool
pub fn verify(&self, domain: SigningDomain, data: &[u8]) -> bool
Verify the signature over data under the receiver’s domain, with the signing session
judged as of now.
Sourcepub fn verify_at(&self, domain: SigningDomain, data: &[u8], at_ms: u128) -> bool
pub fn verify_at(&self, domain: SigningDomain, data: &[u8], at_ms: u128) -> bool
Verify the signature over data under the receiver’s domain, with the signing session
judged as of the instant at_ms.
Post: true implies the session was authorized and live at at_ms and signed the
transcript of (domain, data, ts_ms, ttl_ms). Proof liveness is not judged here; see
Self::is_live_at.
Sourcepub fn signer_key_at(
&self,
domain: SigningDomain,
data: &[u8],
at_ms: u128,
) -> Option<PublicKey<33>>
pub fn signer_key_at( &self, domain: SigningDomain, data: &[u8], at_ms: u128, ) -> Option<PublicKey<33>>
The delegatee public key that made this signature over data under domain, when it
verifies as of at_ms: the key the signature recovers to, so a reader learns the
signer’s key from the signature alone.
Law: signer_key_at(d, m, t) = Some(k) iff verify_at(d, m, t), and then
Did::from(k.address()) = self.delegation.delegatee_did(): both run one crate-private
path, signer_under, which recovers the key once.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Return whether the verification timestamp is outside its accepted lifetime.
Sourcepub fn is_live_at(&self, now_ms: u128) -> bool
pub fn is_live_at(&self, now_ms: u128) -> bool
Return whether the verification timestamp and TTL describe a currently live proof: the one liveness predicate.
Pre: now_ms is the receiver’s current wall-clock time.
Post: true implies ttl_ms <= MAX_TTL_MS, the timestamp is not beyond the accepted future
skew, and now_ms has not passed ts_ms + ttl_ms.
Sourcepub fn verify_live(&self, domain: SigningDomain, data: &[u8]) -> bool
pub fn verify_live(&self, domain: SigningDomain, data: &[u8]) -> bool
Verify the signature only when the proof is live now.
Sourcepub fn verify_live_at(
&self,
domain: SigningDomain,
data: &[u8],
at_ms: u128,
) -> bool
pub fn verify_live_at( &self, domain: SigningDomain, data: &[u8], at_ms: u128, ) -> bool
Verify the signature as of at_ms, requiring the proof to have been live then: the one
composition of liveness, session validity, and signature every verifying path uses.
Trait Implementations§
Source§impl Clone for MessageVerification
impl Clone for MessageVerification
Source§fn clone(&self) -> MessageVerification
fn clone(&self) -> MessageVerification
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageVerification
impl Debug for MessageVerification
Source§impl<'de> Deserialize<'de> for MessageVerification
impl<'de> Deserialize<'de> for MessageVerification
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageVerification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageVerification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for MessageVerification
Source§impl PartialEq for MessageVerification
impl PartialEq for MessageVerification
Source§impl Serialize for MessageVerification
impl Serialize for MessageVerification
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MessageVerification
Auto Trait Implementations§
impl Forget for MessageVerification
impl Freeze for MessageVerification
impl Move for MessageVerification
impl RefUnwindSafe for MessageVerification
impl Send for MessageVerification
impl Sync for MessageVerification
impl Unpin for MessageVerification
impl UnsafeUnpin for MessageVerification
impl UnwindSafe for MessageVerification
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.