mirror of
https://github.com/luxfi/esign.git
synced 2026-10-30 16:58:18 +00:00
Make Hanzo Base — per-tenant SQLite + extension runtime (HIP-0105,
HIP-0107, HIP-0302) — the canonical production backend. MemStore stays
for tests and ephemeral local dev.
* pkg/basestore — BaseStore implements api.Store on a core.App.
Single esign_envelopes collection holds the canonical JSON
envelope as the body field; state + doc_hash + version +
updated_at are mirrored as indexed columns for cheap dashboard
queries, but the JSON blob is the source of truth so envelope
schema changes never require a SQLite migration.
ensureCollection is idempotent.
Indexes: (state, updated_at DESC), (doc_hash).
* pkg/basestore/store_test.go — round-trip, upsert, missing-id,
empty-id rejection. Uses t.TempDir() so each test isolates its
own SQLite file.
* pkg/api/handlers.go — bump default envelope ID generator from
"env_<8 hex>" to "esign<16 hex>" (21 chars, ^[a-z0-9]+$) to
match Base's default record-id format and clear the 15-char
minimum. ID stays deterministic from the document so identical
bytes get the same envelope ID.
* cmd/esignd — default to BaseStore against `--data-dir esign_data`.
Pass `--memory` for the in-process MemStore (ephemeral, tests).
buildStore handles bootstrap + cleanup so the rest of main stays
a clean wire-up.
Test summary: 4 packages, 26 tests, all green.