# Add e-signatures and clickwrap to Hono

> Add e-signatures and clickwrap to a Hono app on Node.js with the esigncomply package: env(c) for the key, one route for the session, one to confirm.

Source: https://esigncomply.com/hono

Stack · Hono

To add e-signatures and clickwrap to Hono, install `hono`, `@hono/node-server` and the `esigncomply` package. One route creates the session with the secret key, which the handler reads through `env(c)`, the browser SDK attaches to your own form, and a second route confirms the record. Esign Comply seals each acceptance as an independent record anyone can verify.

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/hono)

`npm install hono @hono/node-server esigncomply`

[Hono quickstart](https://esigncomply.com/docs/quickstart/hono)

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

Last updated November 26, 2026

Run in Hono before publishing

**Session route**

server.js (excerpt)

```js
// Step 4: create the session with the secret key. The browser gets the client token only.
app.post("/api/ceremony", async (c) => {
  const { data: session, error } = await client(c).sessions.create(
    {
      profile: env(c).ESIGNCOMPLY_PROFILE_ID,
      signer,
      documents: [
        { document: env(c).ESIGNCOMPLY_TERMS_ID, version: "current" },
        { document: env(c).ESIGNCOMPLY_PRIVACY_ID, version: "current" },
      ],
      // The page that runs the ceremony: the origin the browser reports, plus its path.
      context: { url: `${c.req.header("origin") ?? new URL(c.req.url).origin}/signup`, locale: "en-US", purpose: "account_signup" },
    },
    { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` },
  );
  if (error) return c.json({ error: error.code }, 502);
  pinned.set(signer.external_id, session.documents.map((d) => d.version_id));
  return c.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
```

**Reading the key**

server.js (excerpt)

```js
// env(c) reads process.env on Node.js and the bindings on Cloudflare Workers, so the same
// handlers run on both. On Node.js, c.env holds the raw request and response, not variables.
const client = (c) => new EsignComply(env(c).ESIGNCOMPLY_API_KEY, { baseUrl: env(c).ESIGNCOMPLY_API_URL });
```

**Confirm route**

server.js (excerpt)

```js
// Step 6: confirm the record with the secret key before the account exists.
app.post("/api/signup/confirm", async (c) => {
  // c.req.json() throws on an empty or malformed body: treat that as a record ID that is missing.
  const { recordId } = await c.req.json().catch(() => ({}));
  const { data: record, error } = await client(c).records.get(String(recordId));
  const expected = [...(pinned.get(signer.external_id) ?? [])].sort();
  const confirmed =
    !error &&
    SEALED.includes(record.status) &&
    // Test records in development, live records where ESIGNCOMPLY_LIVE is "true": production only.
    record.livemode === (env(c).ESIGNCOMPLY_LIVE === "true") &&
    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 c.json({ confirmed: false }, 409);
  // Only now create the account, and store record.id and record.receipt with it.
  return c.json({ confirmed: true, recordId: record.id });
```

Integrate with Hono

## How do you integrate Esign Comply with Hono?

On Node.js, Hono runs through `@hono/node-server`, so the `esigncomply` package works in a handler as it is. The handlers read every variable through `env(c)` from `hono/adapter`: on Node.js, `c.env` carries the raw request and response, not the environment. Each route answers with `c.json` or `c.html`.

Hono describes itself as a small, simple, and ultrafast web framework built on Web Standards, and it works on Node.js by using a Node.js adapter.

Source: [Hono documentation](https://hono.dev/docs/), read on November 24, 2026.

[Hono quickstart](https://esigncomply.com/docs/quickstart/hono) · [All stacks](https://esigncomply.com/stacks)

Where each part lives in Hono

- **Session route** · `server.js`
- **Reading the key** · `server.js`
- **Confirm route** · `server.js`

Run on 2026-11-26 with Hono 4.13.21 and @hono/node-server 2.1.11 on Node.js 24.22.1, esigncomply 1.0.4, the browser SDK script build and the conformance check from esigncomply 1.0.4 (--timeout 60), against the API in test mode.

Copy-paste prompt

## What prompt adds Esign Comply clickwrap to a Hono 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 Hono, 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 Hono

```
Add Esign Comply clickwrap to my Hono 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/hono.md (the steps and the tested code for Hono)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Hono facts
- Packages (the only ones that exist): esigncomply (server, Node.js 20.19 or later, an ES module) and @esigncomply/browser. On Node.js, Hono runs through @hono/node-server. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- Read the secret key with env(c) from hono/adapter. On Node.js, c.env holds the raw request and response, not environment variables. The key is ESIGNCOMPLY_API_KEY in a .env file loaded with: node --env-file=.env server.js. Never print it.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- c.req.json() throws on an empty or malformed body. Catch it on the confirm route.
- 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: app.post("/api/ceremony") 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: app.get("/legal/:slug") renders 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: app.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:3000/signup --callback http://localhost:3000/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 Hono?

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

- **On Node.js, c.env is the request, not your variables**

  With `@hono/node-server`, `c.env` holds two keys, `incoming` and `outgoing`. In a test on Hono 4.13.21, `c.env.ESIGNCOMPLY_API_KEY` was undefined and `env(c).ESIGNCOMPLY_API_KEY` from `hono/adapter` held the key. Read every variable through `env(c)`.

- **c.req.json() throws on an empty body**

  The confirm route parses the body itself with `await c.req.json()`. In a test, a `POST` with no body made that call throw and Hono answered `500`. With a catch, the record ID is missing, the API answers `not_found`, and the route refuses with `409`.

- **serveStatic resolves paths from the working directory**

  `serveStatic` comes from `@hono/node-server/serve-static`, and its paths are relative to the folder the process is started in. Started from another folder, the quickstart's server answered `404` for `/signup` while every other route worked.

  Source: [Hono documentation, Node.js](https://hono.dev/docs/getting-started/nodejs), read on November 24, 2026.

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

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

- Quickstart

  **[Hono quickstart](https://esigncomply.com/docs/quickstart/hono)**

  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 Hono?

The same record on every stack and platform. Your Hono 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 Hono

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

Yes, on Node.js. Hono runs there through `@hono/node-server`, so it uses the `esigncomply` server package directly, with `@esigncomply/browser` for the page. There is no Hono middleware to install: the integration is three routes of your own.

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

In a route handler, for example `app.post("/api/ceremony")`, with `esc.sessions.create` and the secret key read through `env(c)`. The handler returns only the client token, the API URL and the pinned documents with `c.json`.

### Why does the quickstart read the key with env(c)?

Because `c.env` is not the environment on Node.js. With the Node.js adapter it holds the raw request and response. `env(c)` from `hono/adapter` returned the key in the test run, where `c.env.ESIGNCOMPLY_API_KEY` was undefined.

### Can the same Hono routes run on Cloudflare Workers?

The quickstart was run on Node.js only. Its `serve` call, `serveStatic` and the in-memory Map are Node.js parts and were not run in a Worker. The Cloudflare Workers page has code that was run there, with the same package in a `fetch` handler and D1 for the state.

### Does Hono parse the JSON body of the confirm request?

Only when the handler asks for it with `await c.req.json()`, and that call throws when the body is empty or is not JSON. In a test, a `POST` with no body answered `500` without a catch. The quickstart catches it and refuses with `409`.

### Other stacks

- [Express](https://esigncomply.com/express)
- [Fastify](https://esigncomply.com/fastify)
- [Node.js](https://esigncomply.com/nodejs)

### Platforms used with Hono

- [Cloudflare Workers](https://esigncomply.com/cloudflare-workers)
- [Cloudflare Pages](https://esigncomply.com/cloudflare-pages)
- [AWS Lambda](https://esigncomply.com/aws-lambda)

[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)

## Add three routes to your Hono app. Leave the record to us.

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

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

Hono is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Hono is from Hono's documentation or from a test run, as marked, on November 24, 2026. `/hono.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.
