Skip to main content

Crate sew_proto

Crate sew_proto 

Source
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 sew and the sew-e2ee client 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|-> and sew 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 caps claim: 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) and LocalDateTime (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 in crate::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 bumps EXPORT_FORMAT. Minor 1: spaces.ndjson records 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.ndjson and space_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 carry on_behalf_approval; an older archive’s on-behalf posts import as pending. Minor 6: space records carry private; a private space imports invite-only. Minor 7: space records carry orphaned_from, member records relinked_from and the install record identity_switched_at. Minor 8 (Sew 0.6.0): space records carry governance and role records the managed-role mark managed. Minor 9 (Sew 0.7.0): space records may carry governance server (the server-governed Space, owned by the k2:server member) and channel records closing. Minor 10 (Sew 0.8.0): space records carry participant_app_ids (the participant links). Minor 11: member records of an erased account carry erased_at and erase_mode (with the erased:<id> external id), messages and attachments the delete and remove kind erased. Minor 12 (Sew 0.9.0): space records carry the recording overrides recording_start_level and recording_required, voice channel records recording_required, and recording records trigger: required for a recording a required room started. Minor 13 (Sew 0.10.0): channel records carry members_can_leave. Minor 14: full exports carry dm_seen.ndjson and read_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).