Version 0.2.4 provides a pure RFC 8489 protocol package, aprotocol-independent STUN transaction engine, RFC 7983 packetdemultiplexing, and the native infrastructure the upcoming UDP/TCP/TLStransports build on.
protocol:
fixed-header, message-type, attribute-frame, and generic message codecs;
IPv4 and IPv6 MAPPED-ADDRESS, XOR-MAPPED-ADDRESS, and ALTERNATE-SERVER values;
USERNAME, REALM, NONCE, SOFTWARE, ERROR-CODE, and UNKNOWN-ATTRIBUTES values;
short-term credentials and legacy MD5 long-term key derivation;
MESSAGE-INTEGRITY and full-length MESSAGE-INTEGRITY-SHA256 signing and verification;
FINGERPRINT generation and verification;
security-attribute order validation; and
complete RFC 5769 request and IPv4/IPv6 response vectors.
engine:
an I/O-free, clock-free event/effect transaction state machine (Engine::handle);
transaction tracking, response correlation, and RFC 8489 §6.2.1 retransmission timing;
a generation-based guard against stale retransmission timers;
an injectable transaction-ID source, with a deterministic generator for tests; and
unauthenticated and short-/long-term-authenticated Binding transaction flows,including inbound MESSAGE-INTEGRITY verification on responses.
mux:
RFC 7983 §7 first-byte demultiplexing into STUN, DTLS, TURN ChannelData,RTP, or RTCP, with an Unknown fallback for short or unrecognized input;
STUN classification confirmed by the RFC 8489 magic cookie; RTP/RTCPdisambiguated by the RFC 5761 §4 RTCP packet-type range.
cmd/main (native target only):
moonbitlang/async@0.21.0, the async runtime the UDP/TCP/TLS transportswill run on, scoped so it cannot leak into protocol/engine; and
the production TransactionId generator for engine's injectable idsource, sourcing OS-grade secure randomness from /dev/urandom andfailing loudly rather than degrading if that source is ever exhausted.
Real sockets/DNS, PRECIS processing, password-algorithm negotiation, andSHA-256 long-term key derivation are outside this release.
Use verify_preferred_message_integrity when either integrity algorithm may bepresent. It verifies SHA-256 whenever that attribute exists, never downgrades aninvalid SHA-256 value to SHA-1, and returns the count of attributes preceding theverified integrity attribute. Attributes at or after that boundary are notauthenticated and must not be treated as authenticated application input.
The algorithm-specific verification methods are low-level operations. AFINGERPRINT detects accidental corruption and protocol multiplexing mistakes; itdoes not authenticate a message.
LongTermCredentialKey::from_credentials implements legacy MD5 derivation overthe exact UTF-8 bytes of username:realm:password. Callers must apply therequired OpaqueString or legacy SASLprep processing before calling it. TheMESSAGE-INTEGRITY-SHA256 API emits and accepts the RFC default full 32-byte value;usage-specific truncation is not supported.
Generic decoding retains attribute values as views into the input and ignoresbytes beyond the length declared in the STUN header. Generic encoding emits zeropadding and does not recompute existing integrity or fingerprint attributes, sosigned messages must be regenerated through the security APIs after mutation.
See DEVELOPMENT.md for the audited MoonBit workflow and DEPENDENCIES.md fordependency decisions. RFC 5769 vector attribution is inTHIRD_PARTY_NOTICES.md.