UNPKG

@biconomy/modules

Version:

This package provides different validation modules/plugins for ERC4337 compatible modular account

75 lines (74 loc) 3.23 kB
import { Signer } from "ethers"; import MerkleTree from "merkletreejs"; import { Bytes } from "ethers/lib/utils"; import { SessionKeyManagerModuleConfig, ModuleVersion, CreateSessionDataParams, ModuleInfo, CreateSessionDataResponse } from "./utils/Types"; import INodeClient from "@biconomy/node-client"; import { BaseValidationModule } from "./BaseValidationModule"; import { ISessionStorage, SessionSearchParam, SessionStatus } from "./interfaces/ISessionStorage"; export declare class SessionKeyManagerModule extends BaseValidationModule { version: ModuleVersion; moduleAddress: string; nodeClient: INodeClient; merkleTree: MerkleTree; sessionStorageClient: ISessionStorage; readonly mockEcdsaSessionKeySig: string; /** * This constructor is private. Use the static create method to instantiate SessionKeyManagerModule * @param moduleConfig The configuration for the module * @returns An instance of SessionKeyManagerModule */ private constructor(); /** * Asynchronously creates and initializes an instance of SessionKeyManagerModule * @param moduleConfig The configuration for the module * @returns A Promise that resolves to an instance of SessionKeyManagerModule */ static create(moduleConfig: SessionKeyManagerModuleConfig): Promise<SessionKeyManagerModule>; /** * Method to create session data for any module. The session data is used to create a leaf in the merkle tree * @param leavesData The data of one or more leaves to be used to create session data * @returns The session data */ createSessionData: (leavesData: CreateSessionDataParams[]) => Promise<CreateSessionDataResponse>; /** * This method is used to sign the user operation using the session signer * @param userOp The user operation to be signed * @param sessionSigner The signer to be used to sign the user operation * @returns The signature of the user operation */ signUserOpHash(userOpHash: string, params?: ModuleInfo): Promise<string>; private getLeafInfo; /** * Update the session data pending state to active * @param param The search param to find the session data * @param status The status to be updated * @returns */ updateSessionStatus(param: SessionSearchParam, status: SessionStatus): Promise<void>; /** * @remarks This method is used to clear all the pending sessions * @returns */ clearPendingSessions(): Promise<void>; /** * @returns SessionKeyManagerModule address */ getAddress(): string; /** * @remarks This is the version of the module contract */ getSigner(): Promise<Signer>; /** * @remarks This is the dummy signature for the module, used in buildUserOp for bundler estimation * @returns Dummy signature */ getDummySignature(params?: ModuleInfo): Promise<string>; /** * @remarks Other modules may need additional attributes to build init data */ getInitData(): Promise<string>; /** * @remarks This Module dont have knowledge of signer. So, this method is not implemented */ signMessage(message: Bytes | string): Promise<string>; }