Struct ethers_signers::AwsSigner [−][src]
pub struct AwsSigner<'a> { /* fields omitted */ }
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
.
pub async fn get_pubkey_for_key<T>(
&self,
key_id: T
) -> Result<VerifyingKey, AwsSignerError> where
T: AsRef<str>,
pub async fn get_pubkey_for_key<T>(
&self,
key_id: T
) -> Result<VerifyingKey, AwsSignerError> where
T: AsRef<str>,
Fetch the pubkey associated with a key id
Fetch the pubkey associated with this signer’s key ID
pub async fn sign_digest_with_key<T>(
&self,
key_id: T,
digest: [u8; 32]
) -> Result<KSig, AwsSignerError> where
T: AsRef<str>,
pub async fn sign_digest_with_key<T>(
&self,
key_id: T,
digest: [u8; 32]
) -> Result<KSig, AwsSignerError> where
T: AsRef<str>,
Sign a digest with the key associated with a key id
Sign a digest with this signer’s key
Trait Implementations
Sets the signer’s chain id
type Error = AwsSignerError
Signs the hash of the provided message after prefixing it
fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<EthSig, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<EthSig, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Signs the transaction
Encodes and signs the typed data according EIP-712. Payload must implement Eip712 trait. Read more
Auto Trait Implementations
impl<'a> !RefUnwindSafe for AwsSigner<'a>
impl<'a> !UnwindSafe for AwsSigner<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
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
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