Expand description
Parley core domain types.
This crate defines the wire types and identifiers for the Parley protocol
as specified in spec/v0.1.md (with auth refactored per spec/v0.4.md §2).
Types are deliberately thin: this crate contains no business logic, no I/O,
no traits. It is depended on by every other crate in the workspace.
Re-exports§
pub use keys::derive_auth_mldsa;pub use keys::derive_identity_ed25519;pub use keys::SEED_BYTES;
Modules§
- keys
- Hierarchical key derivation from a single root seed.
- pow
- Hashcash-style proof-of-work for identity registration.
Spec:
spec/v0.5.md§3.
Structs§
- Agent
Pubkey - Ed25519 public key (32 bytes). Wire format is base64url-no-pad (43 chars).
- BlobId
- Channel
- Channel
Id - Message
- Message
Id - Network
Id - Network identifier, e.g.
"parley-mainnet". Format:[a-z0-9-]{1,64}, no leading or trailing hyphen. See spec §4. - Nonce
- Parsed
Signature - Parsed
Parley-Signatureheader. - Seq
- Monotonic per-channel message sequence number. Starts at 1, dense (no gaps).
Enums§
- Channel
Kind - How a channel handles privacy and encryption.
- Core
Error - Message
Type - Message type discriminator.
- MlDsa
Error - Signature
Parse Error - Signature
Verify Error
Constants§
- EMPTY_
BODY_ SHA256 - SHA-256 of the empty byte sequence, base64url-no-pad. Used for the body-hash field of requests with no body. 43 chars.
- IDEMPOTENCY_
RETENTION_ SECS - Minimum window servers must retain idempotency records, in seconds.
- MAX_
IDEMPOTENCY_ KEY_ BYTES - Maximum size of an
Idempotency-Keyheader value, in bytes. - MAX_
MLS_ CONTENT_ BYTES - Maximum size of an MLS message
contentfield (base64url-encoded bytes on the wire). Generous to accommodate large group commits. - MAX_
TEXT_ CONTENT_ BYTES - Maximum size of a
textmessagecontentfield, in UTF-8 bytes. - ML_
DSA_ PUBKEY_ BYTES - ML-DSA-65 (FIPS 204) public/verification key length, in bytes.
- ML_
DSA_ SIG_ BYTES - ML-DSA-65 (FIPS 204) signature length, in bytes.
- NONCE_
RETENTION_ SECS - Minimum window for which servers must remember nonces, in seconds. Must be at least 2× TIMESTAMP_WINDOW_SECS so an edge-of-skew request cannot be replayed by walking the clock.
- SIGNATURE_
HEADER - HTTP header name carrying the Parley signature.
- SIGNATURE_
VERSION - Signature scheme version. Bump on incompatible changes to the canonical string or header grammar.
- TIMESTAMP_
WINDOW_ SECS - Maximum allowed
|now - ts|in seconds for signature freshness.
Functions§
- body_
sha256_ b64url - Compute SHA-256 of a body and base64url-no-pad encode it.
- build_
header_ value - Build the
Parley-Signatureheader value (v2, hybrid). - canonical_
query_ string - Canonicalize a raw query string per spec §2.2:
parse, sort by key then value, percent-encode each pair, rejoin with
&. - canonical_
string - Build the canonical string-to-sign per spec §2.2.
- ml_
dsa_ sign - Sign a canonical string with an ML-DSA-65 key. Returns raw signature
bytes (
ML_DSA_SIG_BYTESlong). Uses hedged (randomized) signing. - ml_
dsa_ verify - Verify an ML-DSA-65 signature over
canonicalagainst raw verification key bytes. Bothpubkey_bytesandsig_bytesmust be exactly the fixed FIPS 204 lengths or this returnsMlDsaError. - parse_
header_ value - Parse a
Parley-Signatureheader value per spec §2.1. - verify_
signature - Verify an Ed25519 signature against a canonical string.