mirror of
https://github.com/hanzoai/kms.git
synced 2026-10-17 11:18:16 +00:00
Declare operations on the group that serves them
Hanzo CI/CD / cicd (push) Failing after 54m52s
CI/CD / cicd (push) Failing after 54m52s
Hanzo CI/CD / cicd (push) Failing after 54m52s
CI/CD / cicd (push) Failing after 54m52s
zip's registration is a verb method on the group, so an operation reads as the group answering it rather than a function taking the group, and a route that is not a typed operation says which method it answers with. The package-level form and the Router interface it existed to accept any target through are both gone. The toolchain and the pin move together, deliberately. Below zip v1.36.50 the JSON encoder was selected on a build tag, so a repo whose go directive rises first writes a wire that is neither the old release's nor the new one's until the pin catches up. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -69,16 +69,16 @@ func App(root string) (*zip.App, error) {
|
||||
})
|
||||
}
|
||||
}
|
||||
app.Get("/v1/kms/health", probe("ok"))
|
||||
app.Get("/v1/kms/readyz", probe("ready"))
|
||||
app.Raw(http.MethodGet, "/v1/kms/health", probe("ok"))
|
||||
app.Raw(http.MethodGet, "/v1/kms/readyz", probe("ready"))
|
||||
|
||||
// Everything else, over the net/http bridge. AdaptNetHTTP costs ~5% against
|
||||
// native dispatch and preserves the surface exactly. Two prefixes so the
|
||||
// client libraries (/v1/kms/*) and the container probe (/healthz) both work
|
||||
// unchanged; the trailing wildcard is optional, so /healthz itself resolves.
|
||||
h := zip.AdaptNetHTTP(em.HTTPHandler())
|
||||
app.All("/v1/kms/*", h)
|
||||
app.All("/healthz/*", h)
|
||||
app.Raw(zip.MethodAll, "/v1/kms/*", h)
|
||||
app.Raw(zip.MethodAll, "/healthz/*", h)
|
||||
|
||||
return app, nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -56,10 +56,10 @@ func TestBridge_NetHTTPOverZIP(t *testing.T) {
|
||||
DisableStartupMessage: true,
|
||||
AppName: "kms",
|
||||
})
|
||||
kmsApp.Get("/v1/kms/health", func(c *zip.Ctx) error {
|
||||
kmsApp.Raw(http.MethodGet, "/v1/kms/health", func(c *zip.Ctx) error {
|
||||
return c.JSON(http.StatusOK, map[string]any{"status": "ok", "service": "kms"})
|
||||
})
|
||||
kmsApp.All("/v1/kms/*", zip.AdaptNetHTTP(inner))
|
||||
kmsApp.Raw(zip.MethodAll, "/v1/kms/*", zip.AdaptNetHTTP(inner))
|
||||
|
||||
// Same shape as cmd/kmsd: a host app that owns the listener, with its own
|
||||
// middleware in front of the composed subsystem.
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ func TestConnMemory(t *testing.T) {
|
||||
})
|
||||
|
||||
// Mirror the canonical /v1/kms/health route shape (see mount.go).
|
||||
app.Get("/v1/kms/health", func(c *zip.Ctx) error {
|
||||
app.Raw(http.MethodGet, "/v1/kms/health", func(c *zip.Ctx) error {
|
||||
return c.JSON(http.StatusOK, map[string]any{
|
||||
"status": "ok",
|
||||
"service": "kms",
|
||||
@@ -63,7 +63,7 @@ func TestConnMemory(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
var holding atomic.Int64
|
||||
app.Get("/hold", func(c *zip.Ctx) error {
|
||||
app.Raw(http.MethodGet, "/hold", func(c *zip.Ctx) error {
|
||||
holding.Add(1)
|
||||
defer holding.Add(-1)
|
||||
<-ctx.Done()
|
||||
|
||||
@@ -26,7 +26,7 @@ require (
|
||||
github.com/luxfi/trace v1.3.0
|
||||
github.com/luxfi/zap v1.2.7
|
||||
github.com/luxfi/zapdb v1.10.6
|
||||
github.com/zap-proto/zip v1.36.50
|
||||
github.com/zap-proto/zip v1.37.3
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -232,8 +232,8 @@ github.com/zap-proto/http v0.3.9 h1:fD/Zx8FAglMokLGg23dq5Ca3744Hm7bqt3bv8gUk4zI=
|
||||
github.com/zap-proto/http v0.3.9/go.mod h1:UYfGhDDCetgxs65XSev8Lpf65COg5vKQK+cWwZGh4zQ=
|
||||
github.com/zap-proto/mcp v1.0.5 h1:1Hi0KNi4YlWW2zkQUMDK9n3jP3wZaRJ1rseMW9p9F0c=
|
||||
github.com/zap-proto/mcp v1.0.5/go.mod h1:cYOsq+33NyW4X8nUVtIs/qtezVovYazw1s0V7mrQBYA=
|
||||
github.com/zap-proto/zip v1.36.50 h1:b5rEFyAR/uLlvQABb9e17eJbcWiVC9AFvaBgXkql334=
|
||||
github.com/zap-proto/zip v1.36.50/go.mod h1:sjlwTZhK8yLnjLWreVhK9VZrf2M/doKtEaqgZzCx+I0=
|
||||
github.com/zap-proto/zip v1.37.3 h1:QdSB0xqr4c7frwR8c+bVTQSWIpiavPYk3AnMXOpj/LA=
|
||||
github.com/zap-proto/zip v1.37.3/go.mod h1:mYE5BMXclZ14Wz4tw/3ir+QBI7A7DPpi3ROXgwnXpfU=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
|
||||
|
||||
@@ -80,8 +80,8 @@ type RetainedRecord struct {
|
||||
// RegulatorPackage is the encrypted export package for regulatory examination.
|
||||
type RegulatorPackage struct {
|
||||
EncryptedSecrets []byte `json:"encrypted_secrets"`
|
||||
EscrowMaterial []byte `json:"escrow_material"` // wrapped with regulator's HPKE key
|
||||
AuditTrail []byte `json:"audit_trail"` // chain-hashed audit entries
|
||||
EscrowMaterial []byte `json:"escrow_material"` // wrapped with regulator's HPKE key
|
||||
AuditTrail []byte `json:"audit_trail"` // chain-hashed audit entries
|
||||
ExportTimestamp time.Time `json:"export_timestamp"`
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ import (
|
||||
func mockComplianceServer(t *testing.T) (*httptest.Server, *mockComplianceState) {
|
||||
t.Helper()
|
||||
state := &mockComplianceState{
|
||||
retained: make(map[string]RetainedRecord),
|
||||
breakGlass: make(map[string]*BreakGlassToken),
|
||||
auditLog: make([]AuditEntry, 0),
|
||||
secrets: make(map[string][]byte),
|
||||
auditValid: true,
|
||||
retained: make(map[string]RetainedRecord),
|
||||
breakGlass: make(map[string]*BreakGlassToken),
|
||||
auditLog: make([]AuditEntry, 0),
|
||||
secrets: make(map[string][]byte),
|
||||
auditValid: true,
|
||||
}
|
||||
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
+8
-8
@@ -13,11 +13,11 @@ import (
|
||||
|
||||
// Typed errors. Callers branch via errors.Is.
|
||||
var (
|
||||
ErrSecretNotFound = errors.New("kms: secret not found")
|
||||
ErrVersionMismatch = errors.New("kms: version mismatch")
|
||||
ErrVersionNotFound = errors.New("kms: version not found")
|
||||
ErrSecretLocked = errors.New("kms: secret locked")
|
||||
ErrRotateUnsupported = errors.New("kms: rotation unsupported by backend")
|
||||
ErrSecretNotFound = errors.New("kms: secret not found")
|
||||
ErrVersionMismatch = errors.New("kms: version mismatch")
|
||||
ErrVersionNotFound = errors.New("kms: version not found")
|
||||
ErrSecretLocked = errors.New("kms: secret locked")
|
||||
ErrRotateUnsupported = errors.New("kms: rotation unsupported by backend")
|
||||
)
|
||||
|
||||
// Vault is the secrets-storage surface. Namespaced at construction;
|
||||
@@ -69,9 +69,9 @@ type PutOpts struct {
|
||||
|
||||
// Rotation is the result of a Rotate call.
|
||||
type Rotation struct {
|
||||
Name string
|
||||
NewValue []byte
|
||||
NewVersion string
|
||||
Name string
|
||||
NewValue []byte
|
||||
NewVersion string
|
||||
PreviousVersion string
|
||||
// PreviousValidUntil names when the prior version stops resolving
|
||||
// via Get/GetWithMeta (still readable via GetVersion). Zero means
|
||||
|
||||
Reference in New Issue
Block a user