Files
mcr/gen/mcr/v1/codec.go
Kyle Isom 185b68ff6d Phase 10: gRPC admin API with interceptor chain
Proto definitions for 4 services (RegistryService, PolicyService,
AuditService, AdminService) with hand-written Go stubs using JSON
codec until protobuf tooling is available.

Interceptor chain: logging (method, peer IP, duration, never logs
auth metadata) → auth (bearer token via MCIAS, Health bypasses) →
admin (role check for GC, policy, delete, audit RPCs).

All RPCs share business logic with REST handlers via internal/db
and internal/gc packages. TLS 1.3 minimum on gRPC listener.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:46:21 -07:00

45 lines
1.0 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
//
// This file provides a JSON codec for gRPC, used until proto tooling
// is available to generate proper protobuf serialization code.
package mcrv1
import (
"encoding/json"
"fmt"
"google.golang.org/grpc/encoding"
"google.golang.org/grpc/mem"
)
const codecName = "json"
func init() {
encoding.RegisterCodecV2(JSONCodec{})
}
// JSONCodec implements encoding.CodecV2 using JSON serialization.
// It is used as a stand-in until protobuf code generation is available.
type JSONCodec struct{}
func (JSONCodec) Marshal(v any) (mem.BufferSlice, error) {
b, err := json.Marshal(v)
if err != nil {
return nil, fmt.Errorf("json codec: marshal: %w", err)
}
return mem.BufferSlice{mem.NewBuffer(&b, nil)}, nil
}
func (JSONCodec) Unmarshal(data mem.BufferSlice, v any) error {
buf := data.Materialize()
if err := json.Unmarshal(buf, v); err != nil {
return fmt.Errorf("json codec: unmarshal: %w", err)
}
return nil
}
func (JSONCodec) Name() string {
return codecName
}