signMessage
signMessage
supports signing messages from the LitSigner
.
This method must be called after authenticate
. Otherwise, this method will throw an error with the message Not Authenticated
.
Usage
ts
import { createLitSignerWithAuthMethod } from "./lit";
const litSigner = new createLitSignerWithAuthMethod();
const signedMessage = await litSigner.signMessage("Hello World!");
ts
import { polygonMumbai } from "@alchemy/aa-core";
import { LitAuthMethod, LitSigner } from "@alchemy/aa-signers/lit-protocol";
const API_KEY = "<YOUR API KEY>";
const POLYGON_MUMBAI_RPC_URL = `${polygonMumbai.rpcUrls.alchemy.http[0]}/${API_KEY}`;
const PKP_PUBLIC_KEY = "<YOUR PKP PUBLIC KEY>";
export const createLitSignerWithAuthMethod = async () => {
return new LitSigner<LitAuthMethod>({
pkpPublicKey: PKP_PUBLIC_KEY,
rpcUrl: POLYGON_MUMBAI_RPC_URL,
});
};
Returns
Promise<Hex>
A Promise
containing the signature of the message.