Skip to main content

Crate rttp

Crate rttp 

Source
Expand description

§rttp – Rust reference implementation of RTTP (v1.2.6)

rttp:// intent addressing, ROUTE_SHARD derivation, the PulseHeader128 codec, and the published conformance vectors that prove an implementation is right – replayed offline, no repository checkout, [PASS] or it is not.

Zero dependencies by default. SHA-256 is implemented in-crate (known-answer tested), the vectors are read through a minimal in-crate JSON reader, and the crate is #![forbid(unsafe_code)]. The sovereign seal envelope is available behind the optional ed25519 feature – the same split as the Python package’s [ed25519] extra.

§Verify it

$ cargo test          # replays every published conformance check: 37 by
                      # default (1 skipped), 38 with --features ed25519

§Quickstart

use rttp::rttp_uri;

let parsed = rttp_uri::parse("rttp://brain.epoekie.aicent/verify").unwrap();
assert_eq!(parsed.authority, "brain.epoekie.aicent");
assert_eq!(parsed.action, "verify");
// ROUTE_SHARD = SHA-256(ASCII(authority))[0:16] -- pure computation:
assert_eq!(parsed.route_shard_hex(), "459e543b73d86005b72ba77d5756e83c");

§Authority

Grammar: RFC-002 sec. 10.2 ABNF. Frame: RFC-002 sec. 4.1 + SPEC/RTTP-FRAME-EXT-v1.2.6. The rttp URI scheme is submitted to IANA under RFC 7595 (ticket #1459939, Provisional) and is under review – not yet registered. Where this crate and a specification disagree, the specification wins and this crate is wrong.

Re-exports§

pub use rttp_uri::derive_route_shard;
pub use rttp_uri::is_valid_action;
pub use rttp_uri::parse;
pub use rttp_uri::ParsedUri;
pub use rttp_uri::RttpUriError;
pub use pulse_header::build_for_uri;
pub use pulse_header::verify;
pub use pulse_header::ParsedFrame;
pub use pulse_header::PulseHeaderError;
pub use pulse_header::ACTION_MAX_LEN;
pub use pulse_header::VERSION_ID;

Modules§

conformance
Conformance replay – the published vector set, executed against THIS build.
json
Minimal JSON reader/writer – just enough for the conformance vector files.
pulse_header
PulseHeader128 – RFC-002 sec. 4.1 official 128-byte hardware-aligned frame header, plus the v1.2.6 extension block (0x66-0x7F).
rttp_uri
rttp:// URI codec – validate, canonicalise, derive (RFC-002 sec. 10).
seal_asym
Sovereign seal envelope – SPEC/RTTP-SEAL-ENVELOPE-v1.2.6 sec. 3 (Ed25519, self-certifying). Feature-gated (ed25519): the default build stays zero-dependency and still replays the envelope’s signing input and AID self-certification; only the signature arithmetic needs ed25519-dalek.
sha256
Minimal, dependency-free SHA-256 (FIPS 180-4).