Skip to content

ExWeb3/elixir_ethers_kms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EthersKMS - a KMS Signer for Ethers

EthersKMS is a signer library for Ethers using a Key Management Service such as AWS KMS apart from the built-in signers supported by Ethers.

Installation

You can install the package by adding ethers_kms to the list of dependencies in your mix.exs file:

def deps do
  [
    {:ethers_kms, "~> 0.0.3"},
  ]
end

AWS configuration

config :ex_aws,
  access_key_id: CHANGEME,
  secret_access_key: CHANGEME,
  security_token: CHANGEME,
  region: CHANGEME
end

A WebIdentityAdapter can also be used in deployed environments.

Example

MyERC20Token.transfer("0x[Recipient]", 1000)
|> Ethers.send(
  from: "0x[Sender]",
  signer: EthersKMS.AWS.Signer,
  # NOTE: provide a valid kms_key_id here (i.e., ECC_SECG_P256K1 key spec)
  signer_opts: [kms_key_id: kms_key_id]
)

The complete documentation is available on hexdocs.