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.

OpenSeal architecture Clients (the web app, the signing page, integrators through the REST API and webhooks) talk to casual-sign-server. The server and casual-sign-worker share PostgreSQL and an S3-compatible object store. The worker asks casual-sign-keyd to sign digests; keyd holds the key in an HSM through PKCS#11. The worker also reaches email, timestamp authorities and webhook receivers. Server, worker and the browser's verify page all run the same Rust engine: pdf, fields, flatten, seal, verify, audit, certificate and workflow. Anyone can verify a sealed PDF offline with the verify page or the openseal command line. Clients Web app (senders) Signing page Integrators: REST API Anyone: verify offline Operator's deployment casual-sign-serverAPI, ceremony, web app casual-sign-workeremail, sealing, webhooks PostgreSQLrecord, append-only audit Object store (S3)documents, written once casual-sign-keydsigns digests only mTLS HSM / KMSPKCS#11 email · timestamp authority · webhooks Engine: Rust, native and WebAssembly, no I/O, no clock, no keys pdf fields flatten crypto seal verify audit certificate workflow model verify.html (WASM)openseal CLI
Every arrow leaving the deployment goes through a host seam; the engine knows none of them exist.

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.

CrateDoes
casual-sign-pdfBounded reader, repair, decryption with a password, an incremental writer that never touches earlier bytes, and the cleaner that strips active content
casual-sign-model, -fieldsEvery field type, validation, conditions, groups, formulas; page geometry, text extraction, anchors and text tags
casual-sign-flattenDraws values and signatures with embedded subset fonts, or fills the PDF's own form
casual-sign-crypto, -sealCMS, RFC 3161, OCSP and CRL; PAdES B-B to B-LTA as incremental updates; the KeyProvider seam
casual-sign-verifyVerifies any signed PDF and classifies every later revision
casual-sign-audit, -certificateThe hash-chained trail and the certificate of completion
casual-sign-workflowEnvelope and recipient state machines and routing: commands in, new state, events and effects out
casual-sign-sdk, -wasm, -cliThe 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.