@planetarium/aws-kms-provider
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

aws-kms-provider

npm version GitHub Actions Coverage Status

AWS KMS Web3 provider. The provider can sign the transaction using Asymmetric Keys of AWS Key Management Service without managing a private key.

Install

$ npm install aws-kms-provider

Examples

See send-eth.ts.

import Web3 from "web3";
import { KmsProvider } from "aws-kms-provider";

const region = "us-east-1";
const keyId = "xxxxx-xxxx-xxxx-xxxx-xxxxxxxx";
const endpoint =
  "https://ropsten.infura.io/v3/xxxxxxxxxxxx";
const to = "0xabcdef";

async function main() {
  const provider = new KmsProvider(
    endpoint,
    { region, keyIds: [keyId] }
  );

  const web3 = new Web3(provider as any);

  const accounts = await web3.eth.getAccounts();
  console.log("accounts", accounts);

  const receipt = await web3.eth.sendTransaction({
    from: accounts[0],
    to,
    value: web3.utils.toWei("0.00001", "ether")
  });

  console.log(receipt);
}

main().catch(e => console.error(e));

For Developer

Release

$ yarn publish
$ git push origin HEAD
$ git push origin --tags
  • Write a release note.

Readme

Keywords

none

Package Sidebar

Install

npm i @planetarium/aws-kms-provider

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

419 kB

Total Files

69

Last publish

Collaborators

  • planetarium-9c-dx
  • tkiapril
  • longfin
  • akamig
  • riemannulus
  • moreal
  • libplanet