pub struct AwsSigner<'a> { /* private fields */ }
Expand description

An ethers Signer that uses keys held in Amazon AWS KMS.

The AWS Signer passes signing requests to the cloud service. AWS KMS keys are identified by a UUID, the key_id.

Because the public key is unknwon, we retrieve it on instantiation of the signer. This means that the new function is async and must be called within some runtime.

use rusoto_core::Client;
use rusoto_kms::{Kms, KmsClient};

user ethers_signers::Signer;

let client = Client::new_with(
    EnvironmentProvider::default(),
    HttpClient::new().unwrap()
);
let kms_client = KmsClient::new_with_client(client, Region::UsWest1);
let key_id = "...";
let chain_id = 1;

let signer = AwsSigner::new(kms_client, key_id, chain_id).await?;
let sig = signer.sign_message(H256::zero()).await?;

Implementations§

Instantiate a new signer from an existing KmsClient and Key ID.

This function retrieves the public key from AWS and calculates the Etheruem address. It is therefore async.

Fetch the pubkey associated with a key id

Fetch the pubkey associated with this signer’s key ID

Sign a digest with the key associated with a key id

Sign a digest with this signer’s key

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Returns the signer’s chain id

Sets the signer’s chain id

Signs the hash of the provided message after prefixing it
Signs the transaction
Encodes and signs the typed data according EIP-712. Payload must implement Eip712 trait. Read more
Returns the signer’s Ethereum Address

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more