melonask/universal-signer-skills
Overview
This skill guides developers to use @universal-signer/core to provide a single, type-safe signing interface for AWS KMS, GCP KMS, Ledger, Trezor, Turnkey, and local accounts with Viem v2. It shows how to configure provider-specific accounts, create a Viem-compatible client, and sign transactions, messages, and EIP-712 typed data. The guide emphasizes consistent signature normalization and built-in hardware wallet handling.
How this skill works
The library exposes factory functions to create provider-specific accounts (AWS, GCP, Ledger, Trezor, Turnkey, Local) that implement a Viem LocalAccount. You pass the created account and chain/http transport to createUniversalClient to obtain a Viem-compatible client. The client delegates signTransaction, signMessage, and signTypedData calls to the underlying provider while normalizing KMS signatures and handling hardware transport details.
When to use it
- You need one code path that can switch between cloud KMS, hardware wallets, or local keys.
- Building infrastructure that must support multiple signing backends for different environments.
- Implementing secure signing in server-side apps using AWS KMS or GCP KMS.
- Integrating hardware wallets (Ledger, Trezor) in desktop or server contexts with HID handling.
- Using Turnkey or local private keys for development and testing with the same API.
Best practices
- Install only the provider packages you need to minimize dependencies and attack surface.
- Keep KMS keys and access scoped with least privilege; prefer aliases or key IDs for clarity.
- Use the unified Viem client for all blockchain interactions to avoid provider-specific branching.
- Validate signature flow in staging with the same provider types as production (hardware vs cloud).
- Enable and test signature normalization and recovery logic when using cloud KMS providers.
Example use cases
- A backend service that signs transactions with AWS KMS in production and local keys in CI.
- A multiservice platform that offers customer-managed keys hosted in GCP KMS or Turnkey.
- A desktop wallet app that supports Ledger and Trezor via the same signing interface.
- A migration plan to move signing from local keys to cloud KMS without changing application code.
- Integration tests that exercise signTypedData (EIP-712) across all supported providers.
FAQ
No. Install only the providers you will use. Local accounts require no extra dependencies.
How does signature normalization work for KMS?
The library normalizes EIP-2 signatures and computes a correct v recovery value so signatures match Viem expectations.