# Add e-signatures and clickwrap to Deno

> Add e-signatures and clickwrap to a Deno server with Deno.serve and the esigncomply package from npm, started with --env-file and explicit permissions.

Source: https://esigncomply.com/deno

Stack · Deno

To add e-signatures and clickwrap to Deno, add the `esigncomply` package from npm and create the session in a `Deno.serve` handler with the secret key. Start the server with `--env-file` and the permissions it uses: network, environment and read access to the page. The browser SDK attaches to your own form. Esign Comply seals each acceptance as an independent record.

Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/quickstart/deno)

`deno add npm:esigncomply@1.0.4`

[Deno quickstart](https://esigncomply.com/docs/quickstart/deno)

Free plan: 10 live signatures a month and a full test mode. No card required.

Last updated November 26, 2026

Run in Deno before publishing

**Session route**

server.ts (excerpt)

```ts
// Step 4: create the session with the secret key. The browser gets the client token only.
if (req.method === "POST" && url.pathname === "/api/ceremony") {
  const { data: session, error } = await esc.sessions.create(
    {
      profile: Deno.env.get("ESIGNCOMPLY_PROFILE_ID")!,
      signer,
      documents: [
        { document: DOCUMENTS.terms!, version: "current" },
        { document: DOCUMENTS.privacy!, version: "current" },
      ],
      // The page that runs the ceremony: the origin the browser reports, plus its path.
      context: { url: `${req.headers.get("origin") ?? url.origin}/signup`, locale: "en-US", purpose: "account_signup" },
    },
    { idempotencyKey: `signup-${signer.external_id}-${crypto.randomUUID()}` },
  );
  if (error) return Response.json({ error: error.code }, { status: 502 });
  pinned.set(signer.external_id, session.documents.map((d) => d.version_id));
  return Response.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
```

**The client**

server.ts (excerpt)

```ts
import { EsignComply } from "esigncomply";

// The key comes from the environment, which Deno reads only with --allow-env.
const esc = new EsignComply(Deno.env.get("ESIGNCOMPLY_API_KEY"), { baseUrl: Deno.env.get("ESIGNCOMPLY_API_URL") });
```

**deno.json**

`deno.json`

```json
{
  "imports": {
    "esigncomply": "npm:esigncomply@1.0.4"
  }
}
```

**Confirm route**

server.ts (excerpt)

```ts
// Step 6: confirm the record with the secret key before the account exists.
if (req.method === "POST" && url.pathname === "/api/signup/confirm") {
  const { recordId } = await req.json().catch(() => ({}));
  const { data: record, error } = await esc.records.get(String(recordId));
  const expected = [...(pinned.get(signer.external_id) ?? [])].sort();
  const confirmed =
    !error &&
    SEALED.includes(record.status) &&
    record.livemode === LIVE &&
    record.signer.external_id === signer.external_id &&
    JSON.stringify(record.documents.map((d) => d.version_id).sort()) === JSON.stringify(expected);
  console.log(confirmed ? `confirmed ${record!.id} (${record!.status})` : "refused");
  if (!confirmed) return Response.json({ confirmed: false }, { status: 409 });
  // Only now create the account, and store record.id and record.receipt with it.
  return Response.json({ confirmed: true, recordId: record!.id });
```

Integrate with Deno

## How do you integrate Esign Comply with Deno?

On Deno the server is one `Deno.serve` handler in a TypeScript file. `deno add npm:esigncomply` makes the package importable with no `node_modules` folder: it is written for Node.js and was run under Deno 2.9.8 for this page. What is particular to Deno is the start command, which names the `.env` file and every permission the server uses.

Deno is secure by default: unless you specifically enable it, a program run with Deno has no access to sensitive APIs.

Source: [Deno documentation, Security and permissions](https://docs.deno.com/runtime/fundamentals/security/), read on November 24, 2026.

[Deno quickstart](https://esigncomply.com/docs/quickstart/deno) · [All stacks](https://esigncomply.com/stacks)

Where each part lives in Deno

- **Session route** · `server.ts`
- **The client** · `server.ts`
- **deno.json** · `deno.json`
- **Confirm route** · `server.ts`

Run on 2026-11-26 with Deno 2.9.8 (Deno.serve, permissions set by flags), esigncomply 1.0.4 through the npm specifier, the browser SDK script build and the conformance check from esigncomply 1.0.4, against the API in test mode.

Copy-paste prompt

## What prompt adds Esign Comply clickwrap to a Deno app?

Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes in Deno, what to build and what never to do, and it ends with the rules block for your project.

The rules block lives at [/rules.md](https://esigncomply.com/rules.md). Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The [prompt generator](https://esigncomply.com/product/prompt-generator) writes the long version, with your own document and profile IDs.

[Pages for each AI tool](https://esigncomply.com/build)

Prompt: Esign Comply clickwrap in Deno

```
Add Esign Comply clickwrap to my Deno app: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.

Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/deno.md (the steps and the tested code for Deno)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Deno facts
- Packages (the only ones that exist): esigncomply (server) and @esigncomply/browser. The server package is written for Node.js and was run under Deno 2.9.8: add it with deno add npm:esigncomply. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- The secret key is ESIGNCOMPLY_API_KEY in a .env file. Deno reads it only with --env-file=.env, and the code reads it only with --allow-env. Never print the key.
- Deno grants nothing by default. The server needs --allow-net (its own port and the API host), --allow-env and --allow-read for the page.
- Server SDK calls return { data, error } and do not throw. Check error every time. A call the network permission does not allow comes back as the error network_error.
- The page is on screen before the script has a session: render the checkbox disabled and enable it when observeAssent has resolved.

Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. Server: POST /api/ceremony in the Deno.serve handler creates the session with esc.sessions.create and an Idempotency-Key, saves the signer ID and the pinned version IDs in server-owned state, and returns only clientToken, apiUrl and documents.
4. Server: GET /legal/terms and /legal/privacy render the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. Browser: EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }), then complete() from the user's real click.
6. Server: POST /api/signup/confirm reads the record with esc.records.get and requires: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the server-owned state. Only then create the account.

Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.

Check before you report success
- Run: npx esigncomply check --url http://localhost:8000/signup --callback http://localhost:8000/api/signup/confirm
  Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.

Then add the rules block to this project's instruction file: https://esigncomply.com/rules.md
```

3 things to watch

## What goes wrong when you add e-signatures in Deno?

These are specific to Deno. Each one was seen while the quickstart's code was run, or is in Deno's own documentation.

- **Deno does not read .env without --env-file**

  Started without the flag, the quickstart's server answered `502` with `missing_api_key` for the session. `deno run --env-file=.env` loads the file, and `--allow-env` lets the code read what it loaded.

- **A network permission without the API host fails as network_error**

  With `--allow-net` limited to the server's own port, the session route answered `502` with `network_error`: Deno refused the outgoing call and the SDK reported it without throwing. With the API host added to the list, the same route answered `200`.

- **The page needs --allow-read, the key needs --allow-env**

  Without `--allow-read`, `/signup` answered `500` in the test, with `NotCapable: Requires read access`. Without `--allow-env`, the server stopped at the line that reads the key. The quickstart grants read access to the `public` folder only.

  Source: [Deno documentation, Security and permissions](https://docs.deno.com/runtime/fundamentals/security/), read on November 24, 2026.

## Where are the Deno quickstart and the API reference?

Start with the quickstart: it carries every file this page excerpts, in the order you write them.

- Quickstart

  **[Deno quickstart](https://esigncomply.com/docs/quickstart/deno)**

  Step by step, from install to your first sealed test record, with every file and the output of each step.

- Reference

  **[API reference](https://esigncomply.com/docs/api)**

  Every endpoint, field and error code. Sessions, records and documents are the three this page uses.

- Guide

  **[Server confirmation](https://esigncomply.com/docs/guides/server-confirmation)**

  The one place access is granted: what to compare, and the webhook that backs the check up.

Verifiable

## What does Esign Comply record for a signature in Deno?

The same record on every stack and platform. Your Deno code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on [Evidence and verification](https://esigncomply.com/product/evidence).

- **Observed and asserted fields**

  Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.

- **A signed receipt**

  `complete()` returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, and `GET /v1/records/{id}/receipt` returns it again.

- **An external timestamp**

  An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.

- **An offline verifier**

  Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source `esigncomply-verify`, without an account.

[How sealing and verification work](https://esigncomply.com/product/evidence) · [Observed and asserted, in the docs](https://esigncomply.com/docs/concepts/observed-and-asserted) · [The offline verifier](https://esigncomply.com/docs/sdk/verify)

Record

`rec_Z4m8`

simple · L1

Recorded

Written durably, receipt signed with ES256

Timestamped

External RFC 3161 token over the record hash

Anchored

Public anchor pending

Checkbox changed by a trusted user event · observed

Terms of Service, version dv_3kT9 · observed

Server time 2026-11-21T15:03:20.291Z · observed

Signer email dana@example.org · asserted

record_hash sha256:5be7… · example record

## Questions about e-signatures in Deno

### Is there an Esign Comply SDK for Deno?

The server SDK is written for Node.js. It was run under Deno 2.9.8 through the `npm:` specifier for this page: every server call of the quickstart, through three ceremonies of the conformance check. Add it with `deno add npm:esigncomply`.

### Where do I create the session in Deno?

In the `Deno.serve` handler, on `POST /api/ceremony`, with `esc.sessions.create` and the secret key from `Deno.env.get`. The handler returns only the client token, the API URL and the pinned documents with `Response.json`.

### Which permissions does a Deno server need for this?

Three: network, environment and read access to the folder with the page. A narrower form also ran in the test: the network limited to the server's own port and the API host, and the environment limited to the seven variables the code reads.

### Does Deno need npm or a node_modules folder for the package?

No. `deno add npm:esigncomply` wrote `deno.json` with the import and `deno.lock` with the resolved version, and the project folder held no `node_modules`. Deno keeps the package in its own cache.

### How is this page different from the Deno Deploy page?

This page is a server you run yourself, with the npm package, flags for permissions and a `.env` file. The Deno Deploy page is about the platform: its environment variables, Deno KV for the pinned state, and its preview deployments, with plain `fetch` calls.

### Other stacks

- [Bun](https://esigncomply.com/bun)
- [Node.js](https://esigncomply.com/nodejs)
- [Hono](https://esigncomply.com/hono)

### Platforms used with Deno

- [Deno Deploy](https://esigncomply.com/deno-deploy)
- [Supabase](https://esigncomply.com/supabase)

[All stacks](https://esigncomply.com/stacks) · [All platforms](https://esigncomply.com/platforms) · [Clickwrap API](https://esigncomply.com/clickwrap) · [E-signature API](https://esigncomply.com/sign)

## Run the signing flow on Deno. Leave the record to us.

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/quickstart/deno)

Free plan: 10 live signatures a month and a full test mode. No card required.

Deno is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Deno is from Deno's documentation or from a test run, as marked, on November 24, 2026. `/deno.md` is this page as Markdown.

---

Every page on esigncomply.com has a Markdown version at the same URL plus `.md` (the home page is `https://esigncomply.com/index.md`). https://esigncomply.com/llms.txt lists them.

---

Esign Comply is the e-signature API and clickwrap API for developers who build their own signing flow in their own UI: it supplies the ceremony rules as a generated prompt for AI coding tools, records events in direct browser ceremonies, and seals independent, verifiable evidence.
