Expand description
§asx-rs — AS2/AS4 EDI protocol library
asx-rs is an async-native, memory-safe Rust library for the AS2 (RFC 4130) and
AS4 (OASIS ebMS3 + eDelivery) EDI transport protocols. The crate is published as
asx-rs; the library itself is imported as asx_rs.
§Feature flags
The crate uses Cargo feature flags to limit the compiled surface and dependency
tree. The default feature set is
["interop-strict", "async-ocsp", "compression", "trace"].
| Feature | Enables | Required by |
|---|---|---|
as2 | AS2 send/receive free functions (as2::send_sync, as2::receive_sync) and async wrappers (as2::send_async, as2::receive_async) | anything using AS2 |
as4 | AS4 send/receive free functions (as4::send_sync, as4::receive_push_with_dedup_sync), receipt verification (as4::verify_sync_response), As4PullStore, and protocol configuration (pmode, types) | anything using AS4 |
compression | Zlib/GZIP payload compression via flate2 | AS2/AS4 policy.compress = true (default) |
async-ocsp | Async OCSP responder fetching via reqwest | production OCSP validation |
interop-strict | (default) Strict interop mode as the default. Governs header/ambiguity handling only — not the security policy; see InteropMode | All profiles |
interop-relaxed | Relaxed mode helpers available alongside strict | Legacy partner interop |
trace | Experimental tracing instrumentation for selected protocol paths | Observability |
prometheus | Built-in Prometheus/OpenMetrics text MetricsSink adapter (observability::PrometheusMetricsSink) | Native metrics export |
opentelemetry | OpenTelemetry MetricsSink adapter (observability::OtelMetricsSink) | Native metrics export |
dns | Built-in BDXL resolver (smp::HickoryBdxlResolver) for Peppol/CEF participant discovery | SmlDiscovery::Naptr without a custom BdxlResolver |
testing | Exposes fixtures and matrix test-scaffold modules | Integration test harness |
server | Axum router integration (as2_router, as4_router, As2AxumHandler, As4AxumHandler) | HTTP receive |
client | Async HTTP egress transport via reqwest (As2HttpTransport, As4HttpTransport) | HTTP send |
reqwest dependency note:
- Enabling
async-ocsppullsreqwestfor OCSP HTTP fetches. - Enabling
clientalso pullsreqwestfor protocol egress transports. - Enabling both features reuses the same crate dependency; there is no second HTTP stack.
§Minimal feature combinations
# AS2 only (sign, encrypt, OCSP; compression is enabled by default):
asx-rs = { version = "0.14", features = ["as2", "async-ocsp"] }
# AS4 only (sign, encrypt; compression is enabled by default):
asx-rs = { version = "0.14", features = ["as4", "async-ocsp"] }
# Both protocols with compression:
asx-rs = { version = "0.14", features = ["as2", "as4", "compression", "async-ocsp"] }
# AS4 with Peppol/CEF dynamic discovery:
asx-rs = { version = "0.14", features = ["as4", "client", "dns"] }
# Both protocols, relaxed interop for legacy partners:
asx-rs = { version = "0.14", features = ["as2", "as4", "interop-relaxed", "async-ocsp"] }
Note:
as2andas4are not in the default feature set. Addingasx-rswithout explicit features compiles only the shared infrastructure (core,crypto,reliability,observability).
§Security notes
- AS2 trust-verifier traits are intentionally open so applications and tests can supply their own verification backends. Prefer local deterministic test verifiers over crate-exported bypass helpers.
- PKIX chain validation requires at least one trust-anchor PEM in
CertHandle::trust_anchor_pems(fail-closed when empty). - OCSP freshness checking (thisUpdate/nextUpdate) is enforced automatically
when
OcspModeis notDisabled. - HTTP egress transports are HTTPS-only.
Re-exports§
pub use core::AsxError;pub use core::CryptoAdmissionControl;pub use core::ErrorCode;pub use core::ErrorContext;pub use core::Result;pub use credentials::PartnerCredentials;
Modules§
- as2
- as4
- core
- credentials
- Unified cross-protocol credential container for AS2/AS4 send paths.
- crypto
- fixtures
- Fixture-catalog APIs for
testingfeature integration harnesses. - http
- interop
- lifecycle
- matrix
- Interoperability matrix execution APIs for the
testingfeature. - observability
- presets
- Startup validation for regulated deployments.
- reliability
- sbdh
- Standard Business Document Header (SBDH) — UN/CEFACT SBDH 1.3.
- smp
- PEPPOL / CEF Service Metadata Publisher (SMP) client.
- storage
- Pluggable storage backends for dedup and reconciliation.
- transport
- HTTP transport adapters for AS2 and AS4.
- wire