Skip to content

Use Signer trait for channel close signer and fee payer signer#159

Open
takasaki404 wants to merge 4 commits intotempoxyz:mainfrom
bitrouter:feat/signer-trait
Open

Use Signer trait for channel close signer and fee payer signer#159
takasaki404 wants to merge 4 commits intotempoxyz:mainfrom
bitrouter:feat/signer-trait

Conversation

@takasaki404
Copy link
Copy Markdown

Problem

Server-side Tempo signing (close_signer in SessionMethod, fee_payer_signer in ChargeMethod) is hardcoded to alloy::signers::local::PrivateKeySigner. This forces operators to supply raw private keys directly, which is unacceptable for production deployments that use KMS (AWS KMS, GCP Cloud KMS), HSMs, or other managed signing infrastructure.

Why the current implementation is insufficient

PrivateKeySigner is a concrete local signer — it holds an in-memory secret key. Every builder method, struct field, and internal call site is typed against it, making it impossible to plug in any alternative signer without forking the crate. The synchronous sign_hash_sync calls further restrict compatibility, since most KMS-backed signers are inherently async.

Solution

Replace all server-side PrivateKeySigner references with alloy's dyn Signer trait:

  • SessionMethod::close_signerOption<Arc<dyn Signer + Send + Sync>>
  • ChargeMethod::fee_payer_signerOption<Arc<dyn Signer + Send + Sync>>
  • TempoBuilder::fee_payer_signerOption<Box<dyn Signer + Send + Sync>>
  • Builder methods accept impl Signer + Send + Sync + 'static
  • cosign_fee_payer_transaction becomes async fn; all sign_hash_sync calls become sign_hash().await

Client-side code (TempoProvider, TempoSessionProvider) is unchanged — callers still create wallets with PrivateKeySigner which satisfies impl Signer. Existing usage compiles without modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant