mirror of
https://github.com/luxfi/cosigner.git
synced 2026-10-30 16:59:04 +00:00
Decomplect Fireblocks / Utila / Anchorage co-signing out of luxfi/bridge into one orthogonal, stdlib-only leaf. Wire-shape validation keeps secret material off the wire; env + KMS secret stores fetch the secret half by public id; the real Fireblocks REST + RS256-JWT family signs, the Utila and Anchorage families fail loud until their vendor clients land; the dispatcher runs families in parallel behind an AllApproved gate. Errors name the cosigner KIND and never echo the resolved URI, tenant id, or secret path.
45 lines
1.9 KiB
Go
45 lines
1.9 KiB
Go
package cosigner
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// StubFamilyDispatcher fails every cosign step with a clear "no family
|
|
// wired" reason. It is the explicit, LOUD default for any family slot a
|
|
// consumer hasn't configured — so an institutional user hitting an
|
|
// unconfigured family sees a clear failure instead of a silent drop where
|
|
// the swap completes without cosigning at all.
|
|
//
|
|
// Tests should swap in a purpose-built mock instead of using this — the
|
|
// stub's whole purpose is to produce a known failure shape, not to be
|
|
// mockable.
|
|
type StubFamilyDispatcher struct{}
|
|
|
|
// RunUtila returns StatusFailed with a clear "no family wired" reason.
|
|
func (StubFamilyDispatcher) RunUtila(_ context.Context, intent *UtilaIntent, _ string, opts DispatchOptions) Result {
|
|
return Result{
|
|
Intent: Intent{Kind: KindUtila, Utila: intent},
|
|
Status: StatusFailed,
|
|
Reason: fmt.Sprintf("utila cosign: no family wired — set CompositeFamilyDispatcher.UtilaFamily (swap=%s)", opts.SwapID),
|
|
}
|
|
}
|
|
|
|
// RunFireblocks returns StatusFailed with a clear "no family wired" reason.
|
|
func (StubFamilyDispatcher) RunFireblocks(_ context.Context, intent *FireblocksIntent, _ string, opts DispatchOptions) Result {
|
|
return Result{
|
|
Intent: Intent{Kind: KindFireblocks, Fireblocks: intent},
|
|
Status: StatusFailed,
|
|
Reason: fmt.Sprintf("fireblocks cosign: no family wired — set CompositeFamilyDispatcher.FireblocksFamily to FireblocksRESTFamily{} (swap=%s)", opts.SwapID),
|
|
}
|
|
}
|
|
|
|
// RunAnchorage returns StatusFailed with a clear "no family wired" reason.
|
|
func (StubFamilyDispatcher) RunAnchorage(_ context.Context, intent *AnchorageIntent, _ string, opts DispatchOptions) Result {
|
|
return Result{
|
|
Intent: Intent{Kind: KindAnchorage, Anchorage: intent},
|
|
Status: StatusFailed,
|
|
Reason: fmt.Sprintf("anchorage cosign: no family wired — set CompositeFamilyDispatcher.AnchorageFamily (swap=%s)", opts.SwapID),
|
|
}
|
|
}
|