package member import ( "context" "fmt" ) type actorKey struct{} // Actor identifies the calling member in dev mode (JWT middleware not wired yet). type Actor struct { TenantID string UID string } // WithActor stores tenant/uid on the context for member logic handlers. func WithActor(ctx context.Context, tenantID, uid string) context.Context { return context.WithValue(ctx, actorKey{}, Actor{TenantID: tenantID, UID: uid}) } // ActorFromContext reads the dev actor injected by handlers. func ActorFromContext(ctx context.Context) (Actor, error) { v, ok := ctx.Value(actorKey{}).(Actor) if !ok || v.TenantID == "" || v.UID == "" { return Actor{}, fmt.Errorf("missing X-Tenant-ID or X-UID header") } return v, nil }