mirror of
https://github.com/luxfi/hsm.git
synced 2026-11-02 14:23:52 +00:00
The hardware-wallet signers committed in 6d2dc12 reference AirgapTransport,
AirgapFormat, AirgapChallenge and the airgap session helpers. Those types
plus the PKCS#11 / YubiHSM / Nitrokey signers were left untracked, so a
fresh checkout could not compile and the factory cases for coldcard,
foundation, keystone, and ngrave were not actually reachable from
NewSigner — the surface luxfi/mpc cmd/mpcd airgap_command.go is gated on.
This lands the missing files unchanged (real implementation, not stubs):
airgap.go AirgapTransport interface + MockTransport
airgap_random.go crypto/rand wrapper for session IDs
signer_nitrokey.go Nitrokey HSM 2 (PKCS#11 wrapper)
signer_pkcs11.go Universal PKCS#11 entrypoint
signer_pkcs11_cgo.go Real cgo build (//go:build pkcs11)
signer_pkcs11_stub.go Build-tag stub for non-cgo builds
signer_yubihsm.go YubiHSM 2 over yubihsm-connector
signer_yubihsm_helpers.go Object-ID parsing helpers
signer_yubihsm_test.go Coverage for YubiHSM helpers
After this commit hsm.NewSigner("coldcard"|"foundation"|"keystone"|
"ngrave", cfg) returns a real Signer; the file-mediated airgap ceremony
in luxfi/mpc cmd/mpcd remains the operator UX layer (Coldcard microSD is
the canonical product flow), but in-process signers are now wireable for
tests and kiosk transports.
18 lines
644 B
Go
18 lines
644 B
Go
// Copyright (C) 2020-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package hsm
|
|
|
|
import "crypto/ed25519"
|
|
|
|
// ed25519VerifyStdlib wraps stdlib ed25519.Verify. Kept in a separate
|
|
// file so signer_yubihsm.go does not directly depend on crypto/ed25519
|
|
// (the verify path is exercised only by tests using "raw32:" pubkey
|
|
// envelopes — production callers verify with their own pinned key).
|
|
func ed25519VerifyStdlib(pub, msg, sig []byte) bool {
|
|
if len(pub) != ed25519.PublicKeySize || len(sig) != ed25519.SignatureSize {
|
|
return false
|
|
}
|
|
return ed25519.Verify(ed25519.PublicKey(pub), msg, sig)
|
|
}
|