mirror of
https://github.com/hanzoai/id.git
synced 2026-11-03 00:42:22 +00:00
Replaces the Cloudflare Worker (hanzo.id-worker) and the Next.js portal
with a pnpm monorepo following the ~/work/liquidity/id pattern.
Layout:
apps/web/ Vite + React 19 SPA, embeds @hanzo/gui shell
k8s/ Deployment(2) + Service + Ingress (4 hosts, 4 TLS)
pkgs/shared/ @hanzo/id-shared — TenantConfig, resolveTenant,
loadBrand (browser + node)
pkgs/auth/ @hanzo/id-auth — AuthClient (wraps @hanzo/iam REST)
+ LoginForm/SignupForm/ForgotForm/OTPForm
pkgs/idv/ @hanzo/id-idv — pluggable IDV (stub, persona,
onfido, veriff) behind one
IDVProvider interface
legacy-nextjs/ Frozen — Next.js predecessor. Delete after v0.1.0 ships.
Dockerfile Two-stage: pnpm build → hanzoai/static:0.4.1 serves /spa
README.md
LLM.md Architecture, dev, deploy, cutover plan
Tenant resolution: hostname → TenantConfig (orgId, iamUrl, clientId,
appName, publicOrigin, brandPackage). Built-in defaults for
hanzo.id/lux.id/zoo.id/pars.id; runtime override via
IAM_TENANT_CONFIG_JSON env (served as /config.json at pod startup).
Brand resolution: each per-org brand pkg (@hanzo/brand, @luxfi/brand,
@zooai/brand, @parsdao/brand) ships brand.json. The Vite plugin
brandJsonPlugin emits /brand/<pkg>/brand.json verbatim; the browser
fetches the right one based on the resolved tenant. No bundle bloat.
IDV: stub (default for dev), persona, onfido, veriff. Each adapter
implements `IDVProvider` from pkgs/idv/src/provider.ts. Swap providers
with one registration call at boot — portal code unchanged.
Cutover (separate ops PR — not in this commit):
1. Tag + push image ghcr.io/hanzoai/id:0.1.0
2. Apply k8s manifests, cert-manager issues TLS
3. Remove CF Worker routes for hanzo.id/lux.id/zoo.id/pars.id
4. CF A records → 129.212.164.5 (hanzo ingress LB)
5. Archive hanzo.id-worker repo
58 lines
2.9 KiB
TypeScript
58 lines
2.9 KiB
TypeScript
/**
|
|
* Client ID → application/organization map.
|
|
*
|
|
* Used for resolving the correct IAM application from a client_id,
|
|
* e.g. during social login callbacks where we need to know which
|
|
* app and org the login belongs to.
|
|
*/
|
|
|
|
export interface ClientInfo {
|
|
application: string
|
|
organization: string
|
|
}
|
|
|
|
export const CLIENT_APP_MAP: Record<string, ClientInfo> = {
|
|
// Hanzo org
|
|
'hanzo-platform-client-id': { application: 'app-platform', organization: 'hanzo' },
|
|
'hanzo-app-client-id': { application: 'hanzo-id', organization: 'hanzo' },
|
|
'hanzo-id': { application: 'hanzo-id', organization: 'hanzo' },
|
|
'hanzo-console-client-id': { application: 'app-console', organization: 'hanzo' },
|
|
'hanzo-cloud-client-id': { application: 'app-cloud', organization: 'hanzo' },
|
|
'kms-client': { application: 'app-kms', organization: 'hanzo' },
|
|
'hanzo-kms-client-id': { application: 'app-kms', organization: 'hanzo' },
|
|
'hanzo-commerce-client-id': { application: 'app-commerce', organization: 'hanzo' },
|
|
'hanzo-team-client-id': { application: 'app-team', organization: 'hanzo' },
|
|
'hanzobot-client-id': { application: 'app-hanzobot', organization: 'hanzo' },
|
|
'chat-app': { application: 'app-chat', organization: 'hanzo' },
|
|
'hanzo-chat-client-id': { application: 'app-hanzo-chat', organization: 'hanzo' },
|
|
'hanzo-web3': { application: 'app-hanzo-web3', organization: 'hanzo' },
|
|
'app-analytics': { application: 'app-analytics', organization: 'hanzo' },
|
|
'app-insights': { application: 'app-insights', organization: 'hanzo' },
|
|
'bootnode-web': { application: 'app-bootnode', organization: 'hanzo' },
|
|
'zt-console': { application: 'app-zt-console', organization: 'hanzo' },
|
|
'hanzo-storage-client-id': { application: 'app-storage', organization: 'hanzo' },
|
|
'hanzo-auto-client-id': { application: 'app-auto', organization: 'hanzo' },
|
|
'hanzo-flow-client-id': { application: 'app-flow', organization: 'hanzo' },
|
|
// Adnexus org
|
|
'adnexus-app-client-id': { application: 'app-adnexus', organization: 'adnexus' },
|
|
// Lux org
|
|
'lux-app-client-id': { application: 'app-lux', organization: 'lux' },
|
|
'lux-chat-client-id': { application: 'app-lux-chat', organization: 'lux' },
|
|
'lux-kms-client': { application: 'app-lux-kms', organization: 'lux' },
|
|
'lux-web3': { application: 'app-lux-web3', organization: 'lux' },
|
|
'lux-mpc': { application: 'app-lux-mpc', organization: 'lux' },
|
|
// Zoo org
|
|
'zoo-app-client-id': { application: 'app-zoo', organization: 'zoo' },
|
|
'zoo-web3': { application: 'app-zoo-web3', organization: 'zoo' },
|
|
'zoo-mpc': { application: 'app-zoo-mpc', organization: 'zoo' },
|
|
// Pars org
|
|
'pars-app-client-id': { application: 'app-pars', organization: 'pars' },
|
|
'pars-mpc': { application: 'app-pars-mpc', organization: 'pars' },
|
|
// Zen org
|
|
'zen-app-client-id': { application: 'app-zen', organization: 'zen' },
|
|
}
|
|
|
|
export function resolveClient(clientId: string): ClientInfo | undefined {
|
|
return CLIENT_APP_MAP[clientId]
|
|
}
|