pub enum RejectReason {
Show 14 variants
MalformedRequest {
reason: String,
},
UnsupportedType {
type_uri: String,
},
UnsupportedVersion {
type_uri: String,
},
Expired {
expires_at: DateTime<Utc>,
},
Stale {
detail: StaleReason,
},
IdConflict,
ProofRequired,
ProofInvalid {
reason: String,
},
PermissionDenied {
reason: String,
},
WrongRecipient {
in_band: String,
expected: String,
},
IdentityMismatch(ConsistencyError),
TaskFailed {
reason: String,
details: Option<Value>,
},
Unavailable {
retry_after: Option<DateTime<Utc>>,
},
InternalError {
reason: String,
},
}Expand description
Typed rejection conditions a conforming consumer raises while applying SPEC.md §7.2.
Each variant carries the context needed to render a meaningful operator
message and maps to a single StandardCode from §8.3. The From impl
produces an ErrorPayload with the matching code, retryable default,
and a message derived from the variant’s fields.
Use this on the consumer side to turn ?-propagated errors from
resolve_parties / validate_basic / your own task logic into a
well-formed error response.
Variants§
MalformedRequest
The document did not validate against the framework or payload schema.
UnsupportedType
The consumer does not implement this type URI.
UnsupportedVersion
The consumer recognizes the type but not at this MAJOR.MINOR.
Expired
The document’s expiresAt was in the past.
Stale
The document falls outside the consumer’s acceptance window
(SPEC.md §7.2, Bounding the record) — either because its issuedAt
is older than the window, or because it carries no timestamp the
consumer can place in one.
Reported as expired: §8.3 defines no separate code, and the window is
the consumer’s own bound on when it is still willing to act, which is
what expired means to the producer.
Fields
detail: StaleReasonWhich of the two window failures occurred. For the operator’s log; both render the same wire message.
IdConflict
The document’s id matches one the consumer has already accepted, but
its content differs (SPEC.md §7.2 item 11).
The later document MUST NOT be treated as a retry of the original.
ProofRequired
A proof was required by the spec or consumer policy but was missing.
ProofInvalid
A proof was present but failed verification.
PermissionDenied
The requesting party is not authorized to invoke this task.
WrongRecipient
The document’s recipient is set but does not identify the consumer.
Fields
IdentityMismatch(ConsistencyError)
An in-band party identity contradicts the transport-derived value.
TaskFailed
The task was attempted but could not be completed.
Fields
details: Option<Value>Optional spec-defined extension data; carried verbatim into
ErrorPayload::details.
The consumer is temporarily unable to process the task.
InternalError
The consumer encountered an unexpected internal failure.
Implementations§
Source§impl RejectReason
impl RejectReason
Sourcepub fn code(&self) -> StandardCode
pub fn code(&self) -> StandardCode
The StandardCode that corresponds to this rejection.
Sourcepub fn wire_message(&self) -> String
pub fn wire_message(&self) -> String
Message safe to attach to a wire-serialised ErrorPayload.
SPEC.md §8.1 (final paragraph) and §10.4 require error-response
messages to be free of consumer-side authentication context. The
Display implementation (and to_string())
is intentionally chatty for diagnostic purposes — it names both the
in-band and the transport-authenticated identities under
Self::IdentityMismatch and the consumer’s own VID under
Self::WrongRecipient, which makes log lines actionable but is
exactly the identity oracle a wire-exposed message must not provide.
Variants whose Display is already consumer-side-neutral (Expired,
ProofRequired, …) return the same string the Display would. The
variants that would otherwise leak consumer-side state return a
sanitised constant.
§ProofInvalid is sanitised
SPEC §10.4 states the rule for identityMismatch and then generalises
it: “the same principle applies to every standard code: error messages
SHOULD be derived from the code identifier and the Trust Task
specification’s public vocabulary, not from consumer-side
authentication context.”
A ProofInvalid { reason } built from a verifier’s error text is
exactly that context. Real strings a cryptosuite backend produces
include resolve did:web:x: connection refused, verificationMethod … not present in DID document, and verificationMethod is controlled by {vm_did}, not the document issuer {issuer}. Returned on the wire to an
unauthenticated sender — the proof did not verify, so the sender is
by definition not authenticated — those answer questions the sender
asked by choosing what to put in proof: which DIDs this consumer can
reach, whether a resolver is up, and what a DID document it fetched
contains. That is a resolver-reachability and DID-document oracle, free
of charge and at the sender’s chosen rate.
The reason remains on the Display impl, which
is where the operator reads it.
Sourcepub fn malformed_from_serde(err: &Error) -> RejectReason
pub fn malformed_from_serde(err: &Error) -> RejectReason
Build a malformedRequest from a serde_json failure without echoing
the deserializer’s pointer into the document.
serde_json::Error::to_string() renders as, for example, missing field 'subject' at line 1 column 214 or unknown field 'admin', expected one of … — the member path, the offset, and sometimes the
full set of expected members. On the wire that describes the
consumer’s internal type layout to anyone willing to send malformed
JSON, and the offsets describe how the consumer framed the body.
This maps the error to its category — which is what a producer can
act on — and leaves the detail for the log. Transport bindings that
deserialize a body themselves should use this rather than
format!("{e}"), so one rule holds across the framework.
Trait Implementations§
Source§impl Clone for RejectReason
impl Clone for RejectReason
Source§fn clone(&self) -> RejectReason
fn clone(&self) -> RejectReason
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 RejectReason
impl Debug for RejectReason
Source§impl Display for RejectReason
impl Display for RejectReason
impl Eq for RejectReason
Source§impl Error for RejectReason
impl Error for RejectReason
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ConsistencyError> for RejectReason
impl From<ConsistencyError> for RejectReason
Source§fn from(source: ConsistencyError) -> RejectReason
fn from(source: ConsistencyError) -> RejectReason
Source§impl From<RejectReason> for ErrorPayload
impl From<RejectReason> for ErrorPayload
Source§fn from(reason: RejectReason) -> ErrorPayload
fn from(reason: RejectReason) -> ErrorPayload
Source§impl From<ReplayGuardError> for RejectReason
impl From<ReplayGuardError> for RejectReason
Source§fn from(_: ReplayGuardError) -> RejectReason
fn from(_: ReplayGuardError) -> RejectReason
Source§impl PartialEq for RejectReason
impl PartialEq for RejectReason
impl StructuralPartialEq for RejectReason
Auto Trait Implementations§
impl Freeze for RejectReason
impl RefUnwindSafe for RejectReason
impl Send for RejectReason
impl Sync for RejectReason
impl Unpin for RejectReason
impl UnsafeUnpin for RejectReason
impl UnwindSafe for RejectReason
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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
fn equivalent(&self, key: &K) -> bool
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
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.