pub struct MandateChain {
pub intent: Vec<u8>,
pub cart: Vec<u8>,
pub payment: Vec<u8>,
}Expand description
The three signed, wire-form mandate payloads presented together as one pre-authorization.
Fields§
§intent: Vec<u8>Signed Intent mandate payload (sign_intent_mandate output).
cart: Vec<u8>Signed Cart mandate payload.
payment: Vec<u8>Signed Payment mandate payload.
Implementations§
Source§impl MandateChain
impl MandateChain
Sourcepub fn verify(
&self,
conversation_id: &str,
issuer_public_key: &[u8],
persona_signer: Option<PersonaSignerTrust<'_>>,
now_unix: u64,
) -> Result<VerifiedMandateChain, MandateError>
pub fn verify( &self, conversation_id: &str, issuer_public_key: &[u8], persona_signer: Option<PersonaSignerTrust<'_>>, now_unix: u64, ) -> Result<VerifiedMandateChain, MandateError>
Validate the whole chain: every link is bound to conversation_id
and one consistent caller, the Payment chains (by mandate_hash)
to the Cart and the Cart to the Intent, amounts narrow (never widen)
down the chain, currency agrees, the Cart carries a non-empty
merchant scope, and no link has expired as of now_unix.
Per-link signer trust is resolved separately for each link rather
than against one shared key. The Cart and Payment links ALWAYS
verify against issuer_public_key (the platform mandate-issuing
key) — narrowing a human’s authorization down to a merchant and
amount is never something a browser-held key can do on its own, even
when the Intent above it is user-signed. The Intent link trusts
EITHER issuer_public_key (today’s fully-platform-signed path,
unchanged) OR persona_signer — a PersonaSignerTrust proving the
persona’s own recorded credential is active and was checked recently
enough, passed as Some only when the persona has such a credential
on record — whichever one actually signed it. This function itself
re-checks that trust itself (revocation and freshness), not merely
the caller’s say-so. An Intent signed by neither trusted
key is untrusted. Passing None, or Some evidence that is revoked
or stale, reduces to exactly today’s behavior: this feature is
additive and never a hard requirement.
§Errors
One MandateError per broken invariant — see each variant. Fails
closed on everything: malformed payloads, unknown signers, chain
breaks, widened or unparseable amounts, scope/currency drift,
expiry.
Trait Implementations§
Source§impl Clone for MandateChain
impl Clone for MandateChain
Source§fn clone(&self) -> MandateChain
fn clone(&self) -> MandateChain
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 MandateChain
impl Debug for MandateChain
Source§impl Default for MandateChain
impl Default for MandateChain
Source§fn default() -> MandateChain
fn default() -> MandateChain
Auto Trait Implementations§
impl Freeze for MandateChain
impl RefUnwindSafe for MandateChain
impl Send for MandateChain
impl Sync for MandateChain
impl Unpin for MandateChain
impl UnsafeUnpin for MandateChain
impl UnwindSafe for MandateChain
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
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,
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 more