package gatewayrpc import ( "context" "google.golang.org/grpc" "github.com/samcharles93/archie-core/internal/infrastructure/rpcidentity" ) // unaryPrincipal forwards the context's principal on every unary call. func unaryPrincipal(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return invoker(rpcidentity.Outgoing(ctx, "gateway-client"), method, req, reply, cc, opts...) } // streamPrincipal forwards the context's principal on every stream. func streamPrincipal(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { return streamer(rpcidentity.Outgoing(ctx, "gateway-client"), desc, cc, method, opts...) }