Files
mpc/cmd/mpcd/airgap_command_test.go
zeekay 9fe9342ac8 deps: bump luxfi/hsm v1.1.2 → v1.1.3 (airgap factory cases published)
luxfi/hsm v1.1.3 publishes the missing surface (AirgapTransport/Format,
plus coldcard/foundation/keystone/ngrave/gridplus/ledger/trezor signers
and pkcs11/yubihsm/nitrokey) that cmd/mpcd airgap_command.go was gated
on. The file-mediated ceremony orchestration stays as-is — Coldcard
microSD and BBQr/UR QR flows are the canonical product UX, not stubs.

What changes:
  cmd/mpcd/airgap_command.go      drop the v1.1.2 'gated downstream'
                                  caveat from package doc; the surface
                                  is published.
  cmd/mpcd/airgap_command_test.go new round-trip test that asserts every
                                  airgapProviders() name is constructible
                                  via hsm.NewSigner (catches rename drift
                                  or missing factory cases at `go test`,
                                  not at first ceremony).
2025-12-28 18:00:00 -08:00

45 lines
1.3 KiB
Go

// Copyright (C) 2020-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package main
import (
"testing"
"github.com/luxfi/hsm"
)
// TestAirgapProvidersRoundTripFactory enforces the contract documented
// on airgapProviders(): every reserved provider name MUST be a known
// factory case in luxfi/hsm. We supply each constructor's required
// fields so we exercise the dispatch table and the per-signer
// validators — the goal is to catch missing factory cases or rename
// drift, not to validate operational config.
func TestAirgapProvidersRoundTripFactory(t *testing.T) {
t.Parallel()
cases := map[string]map[string]string{
"coldcard": {"device_id": "test"},
"foundation": {"device_id": "test"},
"keystone": {"device_id": "test", "ur_type": "eth-sign-request"},
"ngrave": {"device_id": "test", "ur_type": "eth-sign-request"},
}
for _, p := range airgapProviders() {
cfg, ok := cases[p]
if !ok {
t.Fatalf("airgap_command_test: missing test config for provider %q — extend cases", p)
}
signer, err := hsm.NewSigner(p, cfg)
if err != nil {
t.Fatalf("hsm.NewSigner(%q): %v", p, err)
}
if signer == nil {
t.Fatalf("hsm.NewSigner(%q): nil signer with no error", p)
}
if got := signer.Provider(); got != p {
t.Fatalf("hsm.NewSigner(%q).Provider() = %q", p, got)
}
}
}