Skip to content

Load eth_keystore into a live PrivateKeySigner #406

Closed

Description

@alpergundogdu

Context

The eth_keystore config field is plumbed through and validated readable at startup (crates/node/src/config/mod.rs:311-339, crates/node/src/config/types.rs:57), and decdn key-gen advertises generating an Ethereum keystore alongside the Ed25519 node key (crates/node/src/cli/key_gen.rs:7). But:

  • decdn key-gen only writes the Ed25519 key — the Ethereum keystore generation is a no-op (crates/node/src/commands/mod.rs:164-188).
  • Nothing in the runtime loads the keystore JSON into a usable alloy::signers::local::PrivateKeySigner.

This is currently bundled into #327's "Runtime integration" bullet (Alloy provider + signer wiring). Carving it out as a narrow issue because it's genuinely independent of contract calls — anything that needs to sign EIP-712 vouchers (#319) or in-protocol messages will need this signer regardless of whether on-chain RPC is wired up.

Scope (crates/node)

decdn key-gen (extend)

  • Generate a fresh secp256k1 key
  • Encrypt with a user-provided password (prompt via rpassword or read from --password-file)
  • Write Web3 Secret Storage v3 JSON keystore to <output_dir>/keystore.json
  • Print the derived Ethereum address

Runtime keystore loader

  • New module (e.g., crates/node/src/identity/eth.rs) exposing load_eth_signer(path, password) -> Result<PrivateKeySigner> via alloy::signers::local::LocalSigner::decrypt_keystore
  • Source the password from one of: DECDN_KEYSTORE_PASSWORD env var, --keystore-password-file <path>, interactive prompt (TTY-detected fallback)
  • Cache the loaded PrivateKeySigner on the runtime state so it's available to anything needing to sign (vouchers, future on-chain txs)

Tests

  • key-gen round-trip: generate → load → verify recovered address matches
  • Wrong-password rejection
  • Keystore-not-found / unreadable / malformed JSON failure modes
  • A loopback test that signs a sample EIP-712 voucher (from Implement EIP-712 payment voucher creation and verification #319) using the loaded signer and verifies it

Out of scope

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions