Files
esign/embed.go
T
5b32922f39 feat(goja): embed ESM-free e-signature bundle for in-process cloud fold (task #100) (#8)
* feat(goja): embed ESM-free e-signature bundle for in-process cloud fold

Port the Hanzo Sign server-side domain (documents, recipients, fields, signing
flow/state, audit trail, completion) to a self-contained goja bundle exposing
globalThis.handle(req), plus a std-lib-only Go embed module (Bundle()). This is
the HIP-0106 (task #100) fold: the unified hanzoai/cloud binary runs the sign
flow as TS-on-goja backed by Hanzo Base/SQLite — no Next.js/Remix, no Prisma,
no Postgres. Persistence (globalThis.db) and the PDF/PKI seal primitives
(globalThis.pdf) are injected by cloud/clients/sign as Go host-functions.

Claude-Session: https://claude.ai/code/session_016yg7GPhYdWCh9vpp4HEwLZ

* docs(llm): note the in-process cloud goja fold (task #100)

Claude-Session: https://claude.ai/code/session_016yg7GPhYdWCh9vpp4HEwLZ

* refactor(goja): run on the reusable gojabase RW-Base host (__db/__newId/__now/__pdf)

Retarget the bundle to the clients/gojabase contract the captable pilot (#96)
established: handle({route,params,query,orgId,body}); persistence via
__db.query/__db.exec + __newId/__now (one txn per dispatch, commits iff
status<400); the PDF/PKI seal via __pdf.stamp/__pdf.sign injected through
gojabase Config.HostFns. One binding, not two. No behavior change to the flow.

Claude-Session: https://claude.ai/code/session_016yg7GPhYdWCh9vpp4HEwLZ

---------

Co-authored-by: hanzo-dev <dev@hanzo.ai>
2026-07-10 03:06:24 -07:00

28 lines
1.1 KiB
Go

// Package sign embeds the Hanzo Sign goja bundle so the unified hanzoai/cloud
// binary can serve /v1/sign/* in-process via the dop251/goja engine, without a
// Next.js/Remix runtime or Prisma/Postgres (HIP-0106, task #100).
//
// The TypeScript/Remix app remains the primary artifact and reference for the
// domain. This Go file is a read-only embed:
//
// - Bundle() returns goja/bundle.js — the self-contained, ESM-free port of the
// server-side e-signature flow (documents, recipients, fields, signing
// state machine, audit trail, completion) exposing globalThis.handle(req).
//
// The bundle carries LOGIC only. Its two host capabilities — a per-tenant
// Base/SQLite store (globalThis.db) and the PDF/PKI signing primitives
// (globalThis.pdf) — are injected by the Go host in
// github.com/hanzoai/cloud/clients/sign. See goja/README.md for the contract.
package sign
import "embed"
//go:embed goja/bundle.js
var assets embed.FS
// Bundle returns the goja bundle source (goja/bundle.js). The host compiles this
// once and runs it on each pooled goja runtime.
func Bundle() ([]byte, error) {
return assets.ReadFile("goja/bundle.js")
}