/** * All code forked from ethers-gcp-kms-signer repository: * https://github.com/openlawteam/ethers-gcp-kms-signer/tree/master * * We had to fork this code because the repository forces GOOGLE_APPLICATION_CREDENTIALS * to be set with environment variables, but we need a path to pass them directly. */ import { MessageTypes, SignTypedDataVersion, TypedDataV1, TypedMessage } from "@metamask/eth-sig-util"; import { ethers, TypedDataDomain, TypedDataField } from "ethers"; export declare const TypedDataVersion: typeof SignTypedDataVersion; export interface GcpKmsSignerCredentials { projectId: string; locationId: string; keyRingId: string; keyId: string; keyVersion: string; applicationCredentialEmail?: string; applicationCredentialPrivateKey?: string; } interface SigningOptions { /** * The typed data to sign. */ data: V extends "V1" ? TypedDataV1 : TypedMessage; /** * The signing version to use. */ version: V; } export declare class GcpKmsSigner extends ethers.Signer { kmsCredentials: GcpKmsSignerCredentials; ethereumAddress: string; constructor(kmsCredentials: GcpKmsSignerCredentials, provider?: ethers.providers.Provider); getAddress(): Promise; _signDigest(digestString: string): Promise; signMessage(message: string | ethers.utils.Bytes): Promise; /** * Original implementation takes into account the private key, but here we use the private * key from the GCP KMS, so we don't need to provide the PK as signature option. * Source code: https://github.com/MetaMask/eth-sig-util/blob/main/src/sign-typed-data.ts#L510 * . * Sign typed data according to EIP-712. The signing differs based upon the `version`. * * V1 is based upon [an early version of EIP-712](https://github.com/ethereum/EIPs/pull/712/commits/21abe254fe0452d8583d5b132b1d7be87c0439ca) * that lacked some later security improvements, and should generally be neglected in favor of * later versions. * * V3 is based on [EIP-712](https://eips.ethereum.org/EIPS/eip-712), except that arrays and * recursive data structures are not supported. * * V4 is based on [EIP-712](https://eips.ethereum.org/EIPS/eip-712), and includes full support of * arrays and recursive data structures. * * @param options - The signing options. * @returns The '0x'-prefixed hex encoded signature. */ signTypedData({ data, version, }: SigningOptions): Promise; _signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; signTransaction(transaction: ethers.utils.Deferrable): Promise; connect(provider: ethers.providers.Provider): GcpKmsSigner; } export {}; //# sourceMappingURL=signer.d.ts.map