Hanzo AI f6d7abb346 zap: add canonical LoadMnemonic (responsibility split: keys owns mnemonic)
Decomplecting: KMS is the generic secret store; this package owns BIP-39
and mnemonic semantics. The shared LoadMnemonic loader belongs HERE,
not inside luxfi/kms, because the BIP-39 validation + (env-then-KMS)
precedence chain is application-layer behavior over the opaque
Get/Put/List surface KMS exposes.

New API (mirrors what luxfi/kms briefly carried at v1.9.12 — moving
upstream to its real home):

  keys.LoadMnemonic(ctx, addr, env, path)         env-then-KMS
  keys.LoadMnemonicFromKMS(ctx, addr, env, path)  KMS-only
  keys.SplitSecretPath("/foo/bar")                ("/foo/", "bar")

Composes:
  luxfi/kms/pkg/zapclient   transport-only secret reads
  luxfi/go-bip39            phrase validation

Tests: 10 cases covering env-wins, env-invalid-fails-fast, KMS happy
path, missing-args validation, dial-error, GetAt-error, empty +
invalid-shape responses, and the path-split convention.

Layer responsibilities now clean:

  zap-proto/zap   protocol (transport)
  luxfi/kms       opaque secret store over zap
  luxfi/keys      THIS — BIP-39 + BIP44 + mnemonic-from-KMS semantics
  consumers       luxd, lux/cli, netrunner, descending-L1 bootstraps

Follow-up: luxfi/kms v1.9.13 will strip its temporary LoadMnemonic*
helpers (added in v1.9.12 + tagged but unmerged in PR luxfi/kms#5).
2026-05-31 21:29:11 -07:00
2026-02-14 05:26:21 -08:00
S
Description
No description provided
BSD-3-Clause
287 KiB
Languages
Go 100%