bootnode

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package bootnode is the Go port of the Python bootnode backend (bootnode/api/), built natively on Hanzo Base as a plugin.

It consolidates the blockchain developer platform — multi-network OAuth, project API keys, team management, and 1-click network/node/key provisioning — onto Base's IAM + tenant infrastructure. Identity is owned by Hanzo IAM (reused via github.com/hanzoai/base/iam); per-org and per-user data isolation come from the platform plugin's PrincipalIsolation="sqlite" mode; billing is wired through the commerce plugin's Client interface.

Network/NodeFleet/KMSSecret provisioning targets bootno.de/v1 custom resources applied via a dependency-free Kubernetes REST client (plugins/bootnode/kube) — no client-go, no CGO.

This is a foundation: 5 of 20 API modules are ported end-to-end (auth, team, networks, nodes, keys). The remaining modules are tracked in the PR body.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(app core.App, cfg Config)

MustRegister installs the bootnode plugin and panics on error.

func Register

func Register(app core.App, cfg Config) error

Register installs the bootnode plugin.

On OnBootstrap it creates the bootnode collections (idempotent). On OnServe it mounts the API under /v1. A zero-value Config disables the plugin; callers opt in with Enabled:true.

Types

type Config

type Config struct {
	// Enabled gates the whole plugin. A zero-value Config is disabled; callers
	// opt in explicitly. Mirrors the waitlist plugin convention.
	Enabled bool

	// IAMEndpoint is the Hanzo IAM base URL (default https://hanzo.id).
	IAMEndpoint string

	// IAMClientID / IAMClientSecret are the bootnode service's IAM application
	// credentials, used for the OAuth2 authorization-code exchange.
	IAMClientID     string
	IAMClientSecret string

	// AllowedOrgs restricts which IAM orgs may authenticate. Empty means the
	// canonical four (hanzo, zoo, lux, pars).
	AllowedOrgs []string

	// FrontendURL is the default OAuth redirect base when a request omits an
	// explicit redirect_uri (default http://localhost:3001).
	FrontendURL string

	// APIKeySalt is mixed into the SHA-256 of bootnode-issued API keys (bn_…)
	// before storage. Required in production; the plugin refuses to start with
	// the insecure default when IAMEndpoint points at a non-local host.
	APIKeySalt string

	// KubeNamespace is the namespace bootno.de CRs are applied into
	// (default "bootnode").
	KubeNamespace string

	// CommerceURL / CommerceAPIKey configure the Hanzo Commerce billing client.
	// An empty API key disables billing (no-op).
	CommerceURL    string
	CommerceAPIKey string
}

Config is the bootnode plugin configuration. It ports the environment-driven idioms of the Python bootnode/config.py (pydantic-settings) without the commodity-chain RPC catalogue — those URLs belong in the chain registry, not plugin config. Only what must vary between environments lives here.

IAM and KMS endpoints are intentionally shared with the platform plugin: a bootnode deployment is always co-resident with platform, so it reuses the same IAM client surface (github.com/hanzoai/base/iam).

func ConfigFromEnv

func ConfigFromEnv() Config

ConfigFromEnv builds a Config from the standard bootnode environment variables. Used by the default Base wiring; tests construct Config directly.

type Identity

type Identity struct {
	UserID string
	Email  string
	Org    string
	// ReadOnly is true for publishable (pk-) keys.
	ReadOnly bool
}

Identity is the resolved caller context for a request: who they are (IAM user id + org) and, when applicable, the bootnode project they act within.

Directories

Path Synopsis
Package auth ports the bootnode authentication surface: the multi-network OAuth2 callback (lux-web3 shared client id) and bootnode-issued API keys.
Package auth ports the bootnode authentication surface: the multi-network OAuth2 callback (lux-web3 shared client id) and bootnode-issued API keys.
Package kube is a dependency-free Kubernetes REST client scoped to exactly what the bootnode plugin needs: server-side-apply of namespaced custom resources (bootno.de/v1 Network, NodeFleet, KMSSecret).
Package kube is a dependency-free Kubernetes REST client scoped to exactly what the bootnode plugin needs: server-side-apply of namespaced custom resources (bootno.de/v1 Network, NodeFleet, KMSSecret).
Package models defines the Base collections backing the bootnode plugin.
Package models defines the Base collections backing the bootnode plugin.
Package workers ports the bootnode background workers.
Package workers ports the bootnode background workers.

Jump to

Keyboard shortcuts

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