caelum0x 77324a7b50 feat(ration): split gateway into auth/tenant-registry/card-issuance/webhook-ingestion
Phase 2 service decomposition per docs/SCALE-EXPANSION.md section 1: extracts
internal/{airwallex,bridge,card,tenant,httpserver} out of the monolithic
gateway into four independently deployable gRPC services (each own go.mod,
Dockerfile, and tests), with gateway now a thin BFF that fans out through new
cardissuanceclient/webhookeventsclient gRPC clients. gateway.proto's external
surface is unchanged — agent/tui/cli still talk to gateway exactly as before.

Verified: all 10 go.work modules build and `go test ./...` passes across
every one, including the new gateway client packages against the live split
services (via `make build && make test`).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:25:41 +03:00

25 lines
922 B
Go

// Package idgen generates short, unique, non-sequential identifiers used
// for normalized event IDs. webhook-ingestion's own copy of this tiny
// utility (see docs/adr/0004: idgen is shared support, not owned by one
// service, so each extracted service gets its own copy rather than a
// shared internal Go module). It avoids pulling in an external UUID
// dependency for a single 16-byte random hex token.
package idgen
import (
"crypto/rand"
"encoding/hex"
"fmt"
)
// New returns a new identifier of the form "<prefix>_<32 hex chars>".
// It panics only if the system CSPRNG is unavailable, which indicates a
// broken runtime environment rather than a recoverable error.
func New(prefix string) string {
var buf [16]byte
if _, err := rand.Read(buf[:]); err != nil {
panic(fmt.Sprintf("idgen: system random source unavailable: %v", err))
}
return fmt.Sprintf("%s_%s", prefix, hex.EncodeToString(buf[:]))
}