diff --git a/src/index.ts b/src/index.ts index 55e36a6..7d7ddd7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { ethers, UnsignedTransaction } from "ethers"; import { getPublicKey, getEthereumAddress, requestKmsSignature, determineCorrectV } from "./util/aws-kms-utils"; - +import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer"; export interface AwsKmsSignerCredentials { accessKeyId?: string; secretAccessKey?: string; @@ -43,6 +43,11 @@ export class AwsKmsSigner extends ethers.Signer { return this._signDigest(ethers.utils.hashMessage(message)); } + async signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise { + const hash = ethers.utils._TypedDataEncoder.hash(domain, types, value); + return this._signDigest(hash); + } + async signTransaction(transaction: ethers.utils.Deferrable): Promise { const unsignedTx = await ethers.utils.resolveProperties(transaction); const serializedTx = ethers.utils.serializeTransaction(unsignedTx);