npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

aws-kms-signer-nodejs

v0.0.6

Published

AWS KMS Signer for Ethereum and Tron

Readme

AWS KMS Signer for Ethereum and Tron

A secure and efficient signer implementation for Ethereum and Tron networks using AWS KMS (Key Management Service) instead of plaintext private keys.

Features

  • 🔐 Secure key management using AWS KMS
  • ⚡ Support for both Ethereum and Tron networks
  • 📝 Message signing (including EIP-191 and TIP-191 standards)
  • 🔄 Transaction signing
  • ✅ TypeScript support
  • 🧪 Comprehensive test suite

Installation

npm install aws-kms-signer-nodejs

Prerequisites

  • An AWS account with KMS access
  • AWS credentials configured in your environment
  • Node.js 20 or higher

Quick Start

Setting up AWS KMS

  1. Create an asymmetric signing key in AWS KMS:

    • Key type: ECC_SECG_P256K1
    • Key usage: SIGN_VERIFY
    • Signing algorithm: ECDSA_SHA_256
  2. Note down the Key ID (you'll need this for the signer)

Ethereum Signer Usage

import { EthereumSigner } from "aws-kms-signer";

// Initialize the signer
const signer = new EthereumSigner({
  keyId: "your-kms-key-id",
  rpcUrl: "any-ethereum-rpc-endpoint",
});

// Get the Ethereum address
const address = await signer.getAddress();

// Sign a message
const message = "Hello, Ethereum!";
const signature = await signer.signMessage(message);

// Sign a transaction
const transaction = {
  to: "0x...",
  value: ethers.parseEther("0.1"),
  // ... other transaction parameters
};
const signedTx = await signer.signTransaction(transaction);

Tron Signer Usage

import { TronSigner } from "aws-kms-signer";

// Initialize the signer
const signer = new TronSigner({
  keyId: "your-kms-key-id",
});

// Get the Tron address
const address = await signer.getAddress();

// Sign a message (TIP-191 compliant)
const message = "Hello, Tron!";
const signature = await signer.signMessageV2(message);

// Sign a transaction
const transaction = await tronWeb.transactionBuilder.sendTrx(
  "recipient-address",
  1000000, // amount in SUN
  address,
);
const signedTx = await signer.signTransaction(transaction);

API Reference

EthereumSigner

Constructor

new EthereumSigner(
  {
    keyId: string,
    rpcUrl: string,
  },
  {
    network: Network,
    provider: ethers.Provider,
    logger: Logger,
    kmsClient: KMSClient,
  },
);

Methods

  • getAddress(): Promise<string>
  • signMessage(message: string | Uint8Array): Promise<string>
  • signTransaction(transaction: ethers.TransactionRequest): Promise<string>

TronSigner

Constructor

new TronSigner(
  {
    keyId: string,
  },
  {
    network: Network,
    logger: Logger,
    kmsClient: KMSClient,
  },
);

Methods

  • getAddress(): Promise<string>
  • signMessageV2(message: string | Uint8Array): Promise<string>
  • verifyMessageV2(message: string | Uint8Array, signature: string): Promise<string>
  • signTransaction(transaction: TronWebTypes.Transaction): Promise<TronWebTypes.SignedTransaction>

Security Considerations

  • AWS KMS keys never leave the AWS KMS service
  • All signing operations are performed within AWS KMS
  • Access to the KMS key is controlled through AWS IAM policies
  • No private keys are stored in your application

AWS IAM Policy

Minimum required permissions for the AWS user/role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["kms:GetPublicKey", "kms:Sign"],
      "Resource": "arn:aws:kms:region:account-id:key/key-id"
    }
  ]
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Support

For issues and feature requests, please open an issue on GitHub.