Problem
Today the only way to authorize state-changing actions (orders, cancels, modify, withdraw, etc.) is WithPrivateKey, which loads a raw private key into the SDK process and signs in-process inside buildSignSend via Wallet.SignHash. If no key is set, requireWallet() panics.
This rules out setups where the key must never enter the application process — KMS/HSM-backed signing, or a dedicated remote signing service. In those architectures the application is the largest attack surface, and the security goal is that a compromise of that process cannot exfiltrate the key.
Use case
We run a separation-of-duties design: a hardened, minimal signing service holds the keys; our user-facing service must hold none. We still want to use this SDK for order construction/submission, signing each build-step hash via the remote signer.
Proposed solution
Add an external-signer seam alongside WithPrivateKey — a callback that receives the build-step hash and returns the existing Signature:
type Signer func(hashHex string) (*Signature, error)
func WithSigner(fn Signer) Option
func WithSignerAddress(addr string) Option // acting address when no in-process wallet
buildSignSend calls the signer when set, else falls back to Wallet.SignHash. Fully backward compatible — WithPrivateKey is unchanged when no signer is provided.
I have a small, additive implementation with tests and a README section ready and will open a PR referencing this issue. Happy to adjust the API (naming, signature shape) to your preferences.
Problem
Today the only way to authorize state-changing actions (orders, cancels, modify, withdraw, etc.) is
WithPrivateKey, which loads a raw private key into the SDK process and signs in-process insidebuildSignSendviaWallet.SignHash. If no key is set,requireWallet()panics.This rules out setups where the key must never enter the application process — KMS/HSM-backed signing, or a dedicated remote signing service. In those architectures the application is the largest attack surface, and the security goal is that a compromise of that process cannot exfiltrate the key.
Use case
We run a separation-of-duties design: a hardened, minimal signing service holds the keys; our user-facing service must hold none. We still want to use this SDK for order construction/submission, signing each build-step hash via the remote signer.
Proposed solution
Add an external-signer seam alongside
WithPrivateKey— a callback that receives the build-step hash and returns the existingSignature:buildSignSendcalls the signer when set, else falls back toWallet.SignHash. Fully backward compatible —WithPrivateKeyis unchanged when no signer is provided.I have a small, additive implementation with tests and a README section ready and will open a PR referencing this issue. Happy to adjust the API (naming, signature shape) to your preferences.