@thirdweb-dev/wallets
Version:
<p align="center"> <br /> <a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/legacy_packages/sdk/logo.svg?raw=true" width="200" alt=""/></a> <br /> </p> <h1 align="center">thirdweb Wallet SDK</h1> <p align="center"> <a h
63 lines • 3.02 kB
TypeScript
/**
* 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<V extends SignTypedDataVersion, T extends MessageTypes> {
/**
* The typed data to sign.
*/
data: V extends "V1" ? TypedDataV1 : TypedMessage<T>;
/**
* 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<string>;
_signDigest(digestString: string): Promise<string>;
signMessage(message: string | ethers.utils.Bytes): Promise<string>;
/**
* 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<V extends SignTypedDataVersion, T extends MessageTypes>({ data, version, }: SigningOptions<V, T>): Promise<string>;
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
signTransaction(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>): Promise<string>;
connect(provider: ethers.providers.Provider): GcpKmsSigner;
}
export {};
//# sourceMappingURL=signer.d.ts.map