Interface IBusEnvelopeSigner
- Namespace
- Stratara.Abstractions.Messaging
- Assembly
- Stratara.Abstractions.dll
Computes and verifies opaque signatures over the canonical projection of a bus envelope.
Implementations are registered via services.AddBusEnvelopeIntegrity(...); the default
is HMAC-SHA256 backed by SharedKey.
public interface IBusEnvelopeSigner
- Extension Methods
Remarks
The payload supplied to Sign(string) and Verify(string, string?) is the framework-defined
canonical projection of the envelope produced by BusEnvelopeCanonical — a
length-prefixed projection of every field of the message except the signature itself, with the
command body and the carried events covered as SHA-256 digests. Implementations must not
interpret it.
Methods
Sign(string)
Returns an opaque signature string over payload.
string Sign(string payload)
Parameters
payloadstringCanonical projection of the envelope as provided by the framework.
Returns
- string
A string-encoded signature suitable for embedding in the envelope's
Signaturefield.
Verify(string, string?)
Returns true when signature matches the expected signature for
payload. A null or empty signature must return
false. Implementations must use a constant-time comparison.
bool Verify(string payload, string? signature)
Parameters
payloadstringCanonical projection of the envelope as provided by the framework.
signaturestringThe signature read off the envelope, or
nullfor an unsigned envelope.
Returns
- bool
trueif the signature is valid; otherwisefalse.