brand

package
v1.801.307 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package brand is the white-label registry (HIP-0111): the map from a brand id (and from a request Host) to that brand's PUBLIC identity — its canonical OIDC issuer and its serving domains.

It is a LEAF (imports only strings), on purpose. Three unrelated callers need it and none should drag the others in: package cloud derives Config.IAMIssuer and validates token `iss` from it; the light webui console reads it to write the per-Host <title>; and cmd/cloud — the light host, which cannot import package cloud — reaches it through webui to brand the "/" it serves. A brand map that lived in package cloud would be unreachable from the host without linking every subsystem, so the white-label fact lives here, once.

The cloud binary is one artifact serving every brand's API host (api.hanzo.ai, api.lux.cloud, api.zoo.cloud, api.cloud.pars.network, ...). Brand is a per-deployment value (CLOUD_BRAND / --brand). These facts are public (issuer host + brand domain), so they live in code, not in KMS.

Index

Constants

View Source
const Default = "hanzo"

Default is the fallback brand when CLOUD_BRAND is unknown.

Variables

This section is empty.

Functions

func Display

func Display(id string) string

Display is a brand id's human display name: the id with an upper-cased first letter (lux → "Lux", hanzo → "Hanzo"). Derived from the id — one source of truth with the brands registry, no hand-maintained display list. Used to build the white-label console <title>.

func ForHost

func ForHost(host string) string

ForHost is ForHostOK with the Hanzo default for an unmatched Host.

func ForHostOK

func ForHostOK(host string) (string, bool)

ForHostOK resolves a request Host to a brand id from the same `brands` registry, mirroring the hostname→brand semantics of platform.ts's getWhiteLabelBrand: a Host at or under a brand's Domain (api.lux.network, lux.network) is that brand. The port is stripped and the compare is case-insensitive; the longest matching Domain wins so a nested brand domain is never shadowed by a shorter one. ok is false when NO brand domain matches, so the caller can choose its own fallback (the deployment brand) rather than silently emitting Hanzo branding on, say, a Zoo pod hit with an odd Host.

func IssuerFor

func IssuerFor(id string) string

IssuerFor returns the canonical OIDC issuer for a brand id.

func Issuers

func Issuers() []string

Issuers returns the OIDC issuer of every configured white-label brand. The in-binary identity validator (auth_identity.go) trusts a token whose `iss` is any of these, so ONE cloud binary validates hanzo AND lux/zoo/pars tokens. One source of truth: derived from the same `brands` registry above.

Types

type Info

type Info struct {
	// ID is the canonical brand key.
	ID string
	// IAMIssuer is the OIDC issuer (JWKS source) for this brand — the value the
	// JWT `iss` claim must equal and whose /v1/iam/.well-known/jwks signs tokens.
	IAMIssuer string
	// Domain is the brand's primary marketing/site domain (for response scoping
	// and base-URL derivation, e.g. api.<Domain>).
	Domain string
	// AltDomains are additional registrable domains that ALSO belong to this
	// brand, used ONLY for hostname→brand white-label detection (ForHostOK).
	// A brand's real serving surfaces span more than its marketing domain — the
	// cloud console runs on <brand>.cloud hosts (console.lux.cloud,
	// console.zoo.cloud), and a request Host there must brand as Lux/Zoo, never
	// fall through to Hanzo. Base-URL/issuer scoping still uses the primary Domain.
	AltDomains []string
}

Info is the PUBLIC per-brand identity used for token validation + URL scoping. No secrets.

func For

func For(id string) Info

For returns the Info for id, falling back to the Hanzo brand for an unknown id. Lookup is case-insensitive.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL