Files
kms/wire_compat_test.go
zeekayandGitHub e9a83302c1 feat: cloud Mount() per HIP-0106 (#10)
* docs(llm): explicit Upstream attribution line

LICENSE-attested or repo-attested upstream is now called out at the
top of LLM.md alongside the project description, so downstream
audits (universe/docs/PRODUCTS.md) can rely on a single canonical
location for the OSS lineage statement.

* feat: cloud Mount() per HIP-0106

Adds pkg/kms.Mount(*zip.App, cloud.Deps) error so the unified Hanzo
Cloud binary can blank-import and register the in-process KMS
server alongside every other Hanzo subsystem.

- pkg/kms/mount.go: native /v1/kms/health + /v1/kms/readyz zip
  handlers and zip.AdaptNetHTTP wrap of the existing Embed mux at
  /v1/kms/* + /healthz. init() registers with cloud.Register("kms",
  10, …) so blank import wires the subsystem in.
- cmd/kmsd: rewritten as a HIP-0106 thin shim — cloud.LoadConfig +
  cloud.BuildDeps + zip.New + kms.Mount + app.Listen. The Embed
  surface is unchanged; only assembly moves through zip.
- schema/kms.zap: minimal Health ZAP interface; full secret/key
  surfaces land in follow-up PRs.

Standalone kmsd binary still ships via the existing Dockerfile and
CI workflow.

* refactor: collapse pkg/kms/ → root for clean import path

Subsystem code lives in package kms at repo root. Importers now use
`github.com/hanzoai/kms` (no /pkg/kms/ nesting). Standalone shim moved
to cmd/kms/ where applicable.

Per Hanzo Go-stdlib pattern: repo IS the package.

* refactor: flatten import path — github.com/hanzoai/cloud (drop /pkg/cloud)
2026-05-18 23:37:41 -07:00

35 lines
1.0 KiB
Go

package kms
import (
"testing"
"github.com/luxfi/kms/pkg/zapserver"
)
// TestWireCompatibility_OpcodesMatchLuxfi pins the canonical luxfi/kms ZAP
// opcodes so any drift in the upstream surface fails this build. The
// hanzo-kms server registers exactly these opcodes via zapserver.Register —
// see cmd/kmsd/main.go where we call zs.Register(n).
//
// The numeric values here are part of the public wire format. Any change is
// a breaking client/server compatibility break with luxfi clients, and any
// such change must land in luxfi/kms first, not here.
func TestWireCompatibility_OpcodesMatchLuxfi(t *testing.T) {
cases := []struct {
name string
got uint16
want uint16
}{
{"OpSecretGet", zapserver.OpSecretGet, 0x0040},
{"OpSecretPut", zapserver.OpSecretPut, 0x0041},
{"OpSecretList", zapserver.OpSecretList, 0x0042},
{"OpSecretDelete", zapserver.OpSecretDelete, 0x0043},
}
for _, c := range cases {
if c.got != c.want {
t.Errorf("%s opcode drifted from canonical luxfi/kms: got 0x%04X want 0x%04X",
c.name, c.got, c.want)
}
}
}