pub trait SigningPort: Send + Sync {
// Required method
fn sign(
&self,
input: SigningInput,
) -> impl Future<Output = Result<SigningOutput, SigningError>> + Send;
}Expand description
Port for request signing.
Implement this trait to attach signatures, HMAC tokens, timestamps, or any
other authentication material to outbound requests. The calling adapter
merges the returned SigningOutput into the request before sending.
The trait uses native async fn in traits (Rust 2024 edition) so it is
not object-safe. Use ErasedSigningPort with Arc<dyn ...> when
runtime dispatch is required.
§Example implementation (passthrough — no signing)
use stygian_graph::ports::signing::{SigningPort, SigningInput, SigningOutput, SigningError};
struct NoSigning;
impl SigningPort for NoSigning {
async fn sign(&self, _input: SigningInput) -> Result<SigningOutput, SigningError> {
Ok(SigningOutput::default())
}
}Required Methods§
Sourcefn sign(
&self,
input: SigningInput,
) -> impl Future<Output = Result<SigningOutput, SigningError>> + Send
fn sign( &self, input: SigningInput, ) -> impl Future<Output = Result<SigningOutput, SigningError>> + Send
Sign an outbound request, returning the authentication material to merge.
Implementations must be idempotent — the same input must always
produce a valid (if not byte-for-byte identical) output.
§Errors
SigningError::BackendUnavailable— sidecar / key store unreachableSigningError::InvalidResponse— sidecar returned malformed dataSigningError::CredentialsMissing— signing key absent at call timeSigningError::Timeout— operation exceeded the configured deadline
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.