Expand description
Sew wire contracts.
Every wire type lives here: ids, chat addresses, errors, HTTP request and response bodies, gateway frames and events, change-log kinds, mgmt API bodies, permission bits, org policies and audit events. Server, clients and K2 share this crate; nothing else defines wire JSON.
The crate is pure: it reads the clock (only in clock) and does no other IO. It builds on
macOS as well as Linux.
Re-exports§
pub use addr::Addr;pub use addr::AddrError;pub use addr::ChannelRef;pub use addr::DmTarget;pub use addr::Handle;pub use addr::Slug;pub use addr::SpaceRef;pub use clock::Clock;pub use clock::SystemClock;pub use error::ApiError;pub use error::Code;pub use error::ErrorBody;pub use error::Validate;pub use error::ValidationError;pub use external_id::ExternalId;pub use http::IdempotencyKey;pub use http::Nonce;pub use http::Page;pub use http::PageQuery;pub use http::Patch;pub use id::Id;pub use id::IdGenerator;pub use id::IdList;pub use id::NodeId;pub use id::id_to_time;pub use perms::Perms;pub use time::Timestamp;
Modules§
- addr
- Chat addresses.
- api
- Client API request and response bodies.
- audit
- Audit events and their canonical JSON.
- calls
- DM and group-DM calls: the call object, rings, the call-record summary on the DM’s message, the call routes’ bodies and the call events.
- changes
- Change-log kinds and notification reasons.
- clock
- The one time source.
- e2ee
- Call key delivery: the wire contract between the MLS delivery
service in
sewand thesew-e2eeclient library. - emoji_
token - Custom emoji tokens in message bodies, shared by Sew, K2 and clients.
- error
- Error envelope and codes.
- export
- The logical export archive, format 1.
- external_
id - External identities.
- gateway
- The websocket gateway.
- http
- HTTP conventions shared by the client and mgmt APIs.
- id
- Time-sortable 64-bit ids.
- install
- Install inputs as JSON:
sew install --config-json <FILE|->andsew media install --config-json <FILE|->take their URLs, hosts and paths as one JSON object (from a file, or stdin with-) instead of argv. K2’s root helper allows argv tokens of at most 64 characters from[A-Za-z0-9-_.@=], which a URL or a path cannot be. - limits
- Numeric limits and rate-limit defaults.
- links
- Bare links in message bodies, shared by Sew and clients so both highlight the same links.
- mention
- Mention syntax, shared by Sew, K2 and clients.
- mgmt
- Management API bodies and act-as headers.
- pass
- The K2 chat pass’s optional
capsclaim: an App-wide ceiling over Sew’s own permissions. - perms
- Permission bits and masks.
- policy
- Org policies.
- recording
- Call recording and per-speaker transcripts: the recording object, consent and capture, the consent modal contract, the record-message summary, transcript turns, the audio listing and the compliance download.
- registry
- The one list of wire types. Tests, schema emission and Sew’s contract document read it.
- routes
- Path templates for the routes named in the contracts, in axum 0.8 syntax.
- search
- Search: the pure query parser shared by the server, K2 and clients, so a query can be
validated before it is sent. Wire bodies live in
crate::api::search; the syntax is what this module’s parser accepts. - time
- Wire times:
Timestamp(a UTC instant),Date(a calendar day) andLocalDateTime(a wall-clock minute with no zone). - token
- Opaque token prefixes and shapes.
- voice
- Voice channels: voice states, the
join, self-state, moderation and move bodies, the two voice dispatch bodies, READY’s voice
sections and
status.voice. The key half of a join (e2ee) is incrate::e2ee. - voice_
notify - Voice room notifications: the room start (
voice_started) and voice invites (voice_invite). - when
- Time input for scheduled sends, reminders and snoozes.
Constants§
- EXPORT_
FORMAT - Logical export archive format version carried in export manifests.
- EXPORT_
FORMAT_ MINOR - Additive revision of export format 1. Readers refuse archives with
a higher minor (
format_too_new); a breaking change bumpsEXPORT_FORMAT. Minor 1:spaces.ndjsonrecords carry the space’s default channels, description, rules and welcome channels. Minor 2: they also carry the App a space belongs to. Minor 3: and whether a space is hidden. Minor 4:space_bans.ndjsonandspace_timeout_carry.ndjson; importing an older minor gives every role holding REMOVE_MEMBERS (bit 38) BAN_MEMBERS (bit 47), as the migration did. Minor 5: message records of on-behalf posts carryon_behalf_approval; an older archive’s on-behalf posts import as pending. Minor 6: space records carryprivate; a private space imports invite-only. Minor 7: space records carryorphaned_from, member recordsrelinked_fromand the install recordidentity_switched_at. Minor 8 (Sew 0.6.0): space records carrygovernanceand role records the managed-role markmanaged. Minor 9 (Sew 0.7.0): space records may carry governanceserver(the server-governed Space, owned by thek2:servermember) and channel recordsclosing. Minor 10 (Sew 0.8.0): space records carryparticipant_app_ids(the participant links). Minor 11: member records of an erased account carryerased_atanderase_mode(with theerased:<id>external id), messages and attachments the delete and remove kinderased. Minor 12 (Sew 0.9.0): space records carry the recording overridesrecording_start_levelandrecording_required, voice channel recordsrecording_required, and recording recordstrigger: requiredfor a recording a required room started. Minor 13 (Sew 0.10.0): channel records carrymembers_can_leave. Minor 14: full exports carrydm_seen.ndjsonandread_receipt_prefs.ndjson(read receipts in DMs). - EXPORT_
MINOR_ BAN_ MEMBERS - The first export minor that carries BAN_MEMBERS (bit 47) itself.
- PROTOCOL_
VERSION - Client API and gateway protocol version. Changes only with a breaking change after the first release.
- RECORDER_
DISPLAY_ NAME - The recorder participant’s user-facing name. Clients label
the recorder’s roster entry, the recording banner and notices with it. The engine never sees
it (only the pseudonymous
p_…identity); the binary, unit and user stay Sew’s call recorder (not published).