Class BusEnvelopeIntegrityVerifier
- Namespace
- Stratara.Abstractions.Messaging
- Assembly
- Stratara.Abstractions.dll
Static helper that resolves the integrity-verification decision for a single inbound bus envelope
(CommandEnvelope or EventBundle). Centralises the rules so the three consuming
workers (Mediator-command, projection, saga) share identical Off / Permissive / Strict semantics.
public static class BusEnvelopeIntegrityVerifier
- Inheritance
-
BusEnvelopeIntegrityVerifier
- Inherited Members
Remarks
The helper is logger-free on purpose — each worker owns its own structured-logging vocabulary (command vs event bundle) and decides which extension method to invoke on the BusEnvelopeIntegrityResult the helper returns.
Methods
Verify(IBusEnvelopeSigner?, BusEnvelopeIntegrityMode, string, string?)
Returns the verification outcome for an envelope given the configured mode and the supplied signer / canonical payload / signature.
public static BusEnvelopeIntegrityResult Verify(IBusEnvelopeSigner? signer, BusEnvelopeIntegrityMode mode, string canonical, string? signature)
Parameters
signerIBusEnvelopeSignerThe signer to delegate to, or
nullwhen no signer is registered.modeBusEnvelopeIntegrityModeThe current Mode.
canonicalstringThe canonical projection of the envelope as produced by BusEnvelopeCanonical.
signaturestringThe signature read off the envelope;
nullor empty for an unsigned envelope.
Returns
- BusEnvelopeIntegrityResult
- Skipped when mode is Off or no signer is registered.
- Verified when the signature matches.
- RejectedPermissive when the signature is
nullor empty, or does not verify, under Permissive. - RejectedStrict when the signature is
nullor empty, or does not verify, under Strict.
Use the overload with a BusEnvelopeIntegrityFailure parameter to learn which of the two rejection reasons applied.
Verify(IBusEnvelopeSigner?, BusEnvelopeIntegrityMode, string, string?, out BusEnvelopeIntegrityFailure)
Returns the verification outcome for an envelope and reports why it did not verify, so that a caller can tell an unsigned envelope from one whose signature is present but wrong.
public static BusEnvelopeIntegrityResult Verify(IBusEnvelopeSigner? signer, BusEnvelopeIntegrityMode mode, string canonical, string? signature, out BusEnvelopeIntegrityFailure failure)
Parameters
signerIBusEnvelopeSignerThe signer to delegate to, or
nullwhen no signer is registered.modeBusEnvelopeIntegrityModeThe current Mode.
canonicalstringThe canonical projection of the envelope as produced by BusEnvelopeCanonical.
signaturestringThe signature read off the envelope;
nullor empty for an unsigned envelope.failureBusEnvelopeIntegrityFailureAbsent when the envelope carried no signature (
nullor empty), Invalid when it carried one the signer refused, and None when the result is Skipped or Verified.
Returns
- BusEnvelopeIntegrityResult
The same value the four-parameter overload returns.
Remarks
An absent signature is decided here and never reaches the signer. A present signature of any content — including whitespace — is handed to the signer, and refusal is reported as Invalid: a publisher that emits a malformed signature is not one that has not started signing yet.