stuntmaster

Production-grade RFC 8489 STUN for MoonBit — RFC 5769 proven

stun
networking
rfc8489
moon add Camilotk/stuntmaster@0.2.1
Download zip
Author
Version
0.2.1
License
Apache-2.0
Last updated
1 hour ago
Downloads
4

Dependencies

README

#Camilotk/stuntmaster

stuntmaster is the production-grade RFC 8489 STUN stack for MoonBit — proven against every RFC 5769 vector.

#Scope

Version 0.2.0 provides a pure RFC 8489 protocol package with:

  • 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.

Networking, DNS, timers, retransmission policy, secure transaction-ID generation, PRECIS processing, password-algorithm negotiation, and SHA-256 long-term key derivation are outside this release.

#Installation

moon add Camilotk/stuntmaster@0.2.0

Import the protocol package from Camilotk/stuntmaster/protocol.

#Security Boundaries

Use verify_preferred_message_integrity when either integrity algorithm may be present. It verifies SHA-256 whenever that attribute exists, never downgrades an invalid SHA-256 value to SHA-1, and returns the count of attributes preceding the verified integrity attribute. Attributes at or after that boundary are not authenticated and must not be treated as authenticated application input.

The algorithm-specific verification methods are low-level operations. A FINGERPRINT detects accidental corruption and protocol multiplexing mistakes; it does not authenticate a message.

LongTermCredentialKey::from_credentials implements legacy MD5 derivation over the exact UTF-8 bytes of username:realm:password. Callers must apply the required OpaqueString or legacy SASLprep processing before calling it. The MESSAGE-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 ignores bytes beyond the length declared in the STUN header. Generic encoding emits zero padding and does not recompute existing integrity or fingerprint attributes, so signed messages must be regenerated through the security APIs after mutation.

#Development

moon fmt moon fmt --check moon check --deny-warn moon test --deny-warn

See DEVELOPMENT.md for the audited MoonBit workflow and DEPENDENCIES.md for dependency decisions. RFC 5769 vector attribution is in THIRD_PARTY_NOTICES.md.