Skip to main content

Crate parley_core

Crate parley_core 

Source
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§

AgentPubkey
Ed25519 public key (32 bytes). Wire format is base64url-no-pad (43 chars).
BlobId
Channel
ChannelId
Message
MessageId
NetworkId
Network identifier, e.g. "parley-mainnet". Format: [a-z0-9-]{1,64}, no leading or trailing hyphen. See spec §4.
Nonce
ParsedSignature
Parsed Parley-Signature header.
Seq
Monotonic per-channel message sequence number. Starts at 1, dense (no gaps).

Enums§

ChannelKind
How a channel handles privacy and encryption.
CoreError
MessageType
Message type discriminator.
MlDsaError
SignatureParseError
SignatureVerifyError

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-Key header value, in bytes.
MAX_MLS_CONTENT_BYTES
Maximum size of an MLS message content field (base64url-encoded bytes on the wire). Generous to accommodate large group commits.
MAX_TEXT_CONTENT_BYTES
Maximum size of a text message content field, 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-Signature header 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_BYTES long). Uses hedged (randomized) signing.
ml_dsa_verify
Verify an ML-DSA-65 signature over canonical against raw verification key bytes. Both pubkey_bytes and sig_bytes must be exactly the fixed FIPS 204 lengths or this returns MlDsaError.
parse_header_value
Parse a Parley-Signature header value per spec §2.1.
verify_signature
Verify an Ed25519 signature against a canonical string.

Type Aliases§

AuthKeyPair
MLDSA65SigningKey