Architecture overview
OpenSeal is a deterministic, headless agreement engine in Rust, hosted by a server of record. The engine owns the PDF, the fields, the routing rules, the seal and the evidence. The server owns identity, storage, delivery, keys and policy.
Why this shape
OpenSeal's sister projects, OpenCalc and OpenPresent, are document editors where the file is the product and a server only orders edits. In an e-signature product the product is the evidence that the file was agreed to, no party may hold the only copy of it, and no party trusts another. So the engine-and-host split is kept, and the server becomes the system of record.
The engine
Pure Rust crates that compile unchanged to native code and to WebAssembly. Time, randomness, keys, fonts, trust lists and network answers are supplied as values, so the same input gives the same bytes and every verdict is the same on every host.
| Crate | Does |
|---|---|
casual-sign-pdf | Bounded reader, repair, decryption with a password, an incremental writer that never touches earlier bytes, and the cleaner that strips active content |
casual-sign-model, -fields | Every field type, validation, conditions, groups, formulas; page geometry, text extraction, anchors and text tags |
casual-sign-flatten | Draws values and signatures with embedded subset fonts, or fills the PDF's own form |
casual-sign-crypto, -seal | CMS, RFC 3161, OCSP and CRL; PAdES B-B to B-LTA as incremental updates; the KeyProvider seam |
casual-sign-verify | Verifies any signed PDF and classifies every later revision |
casual-sign-audit, -certificate | The hash-chained trail and the certificate of completion |
casual-sign-workflow | Envelope and recipient state machines and routing: commands in, new state, events and effects out |
casual-sign-sdk, -wasm, -cli | The facade, the browser binding, and the openseal command |
The hosts
- casual-sign-server (axum): the REST API described in
api/openapi.yaml, sessions and API credentials, the signing ceremony, and the web app's files. - casual-sign-worker: a PostgreSQL job queue with leases, retries and dead letters; it sends email, runs reminders and expiry, seals, and delivers webhooks.
- casual-sign-keyd: the only process that touches the seal key.
Both server and worker change an envelope only by applying a typed command through the workflow engine, which returns the new state, the audit events and the effects to perform. The audit events are committed in the same transaction as the state change.
The main flows
Send
Upload, admit (bounded parse, active content removed, a report), store the original and its hash, prepare recipients and fields, validate, send. The document hash is fixed and the first recipients are invited.
Sign
The link, authentication, consent, the exact bytes whose hash is in the chain, fields validated by the engine in the browser and again on the server, adopt, review, finish. The workflow advances.
Complete and seal
The last action moves the envelope to completing. The worker flattens values, adds the certificate and the audit trail, has keyd sign the digest, timestamps it, optionally adds long-term validation data, verifies the result, stores it and records envelope.completed with the sealed hash.
Verify
Anyone with the PDF runs the same verifier in the browser or on the command line, against the roots they trust. No server is involved.
The web app
Plain ES modules with no framework and no bundler, as in the sister projects, under a strict Content Security Policy. PDF pages are drawn by pdf.js in a worker with scripting disabled. It is one client of the public API: everything it does, an integrator can do too.
The full design is in docs/02, the high-level design.