kms

package
v1.31.7 Latest Latest
Warning

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

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

Documentation

Overview

Package kms connects IAM to the canonical Lux KMS (github.com/luxfi/kms) over the native ZAP protocol.

Separation of concerns: a consumer points at ONE KMS endpoint; the KMS deployment owns its MPC node set, threshold, and unlock — none of those are a consumer's concern. (This replaces the old BASE_KMS_NODES / _THRESHOLD / _ORG_SLUG / _PASSPHRASE contract, which leaked KMS-cluster internals into every consumer.)

KMS_ADDR   KMS endpoint host:port (default zap.kms.svc.cluster.local:9999)
KMS_PATH   secret path prefix     (default "/")
KMS_ENV    secret environment     (default "default")

When KMS_ADDR is unset the client is disabled and callers fall back to plain os.Getenv — local dev / sandbox keep working with no KMS. IAM is a READER: writing secrets is the KMS service's responsibility, so there is no Set here (matches the canonical luxfi/kms top-level API).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a process-wide singleton that fronts the canonical luxfi/kms client. It holds only the single-endpoint Config — no node list, threshold, org, or passphrase.

func Global

func Global() *Client

Global returns the process-wide client, or nil if KMS is not configured.

func Init

func Init() (*Client, error)

Init parses env and stores the process-wide singleton. Returns (nil, nil) when KMS is not configured.

func InitWithConfig

func InitWithConfig(cfg Config) (*Client, error)

InitWithConfig is Init with an explicit Config (tests point Addr at a stub KMS endpoint).

func (*Client) Env added in v1.19.6

func (c *Client) Env() string

Env returns the configured environment slug (replaces the old Org(); the KMS env is the only scoping a consumer sees).

func (*Client) Get

func (c *Client) Get(key string) (string, error)

Get returns the plaintext value for key at the configured path/env.

func (*Client) GetAll added in v1.19.6

func (c *Client) GetAll() (map[string]string, error)

GetAll fetches every secret at the configured path/env in one round-trip — used by the boot bootstrap to warm the cache.

func (*Client) Ready

func (c *Client) Ready() bool

Ready reports whether a KMS endpoint is configured. The MPC unlock is the KMS server's concern, so there is no consumer-side lock state.

type Config

type Config = luxkms.Config

Config is the single-endpoint luxfi/kms config (Addr/Path/Env). Aliased so callers and tests don't import luxfi/kms directly.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads KMS_ADDR/KMS_PATH/KMS_ENV. Returns (nil, nil) when KMS_ADDR is unset — the caller treats that as "KMS disabled" and falls back to plain env vars.

Jump to

Keyboard shortcuts

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