import { SiweError, SiweMessage } from 'siwe'; import { AxiosInstance } from 'axios'; import { SSXEnsData, SSXEnsResolveOptions, SSXLensProfilesResponse } from '@spruceid/ssx-core'; import { SSXLogFields, SSXServerConfig, SSXServerBaseClass } from '@spruceid/ssx-core/server'; import { ethers } from 'ethers'; import { SessionData, SessionOptions } from 'express-session'; import session from 'express-session'; import { RequestHandler } from 'express'; /** * SSX-Server is a server-side library made to work with the SSX client libraries. * SSX-Server is the base class that takes in a configuration object and works * with various middleware libraries to add authentication and metrics to your server. */ export declare class SSXServer extends SSXServerBaseClass { /** SSXServerConfig object. */ protected _config: SSXServerConfig; /** Axios instance. */ protected _api: AxiosInstance; /** EthersJS provider. */ provider: ethers.providers.BaseProvider; /** Session is a configured instance of express-session middleware. */ session: RequestHandler; constructor(config?: SSXServerConfig); /** * Sets default values for optional configurations */ protected _setDefaults: () => void; /** * Registers a new event to the API * @param data - SSXLogFields object. * @returns True (success) or false (fail). */ log: (data: SSXLogFields) => Promise; /** * Generates a nonce for use in the SSX client libraries. * Nonce is a random string that is used to prevent replay attacks. * Wraps the generateNonce function from the SIWE library. * @returns A nonce string. */ generateNonce: () => string; /** * Verifies the SIWE message, signature, and nonce for a sign-in request. * If the message is verified, a session token is generated and returned. * @param siwe - SIWE Message. * @param signature - The signature of the SIWE message. * @param daoLogin - Whether or not daoLogin is enabled. * @param resolveEns - Resolve ENS settings. * @param nonce - nonce string. * @param resolveLens - Resolve Lens settings. * @returns Request data with SSX Server Session. */ login: (siwe: Partial | string, signature: string, daoLogin: boolean, resolveEns: boolean | SSXEnsResolveOptions, nonce: string, resolveLens?: boolean) => Promise<{ success: boolean; error: SiweError; session: Partial; }>; /** * ENS data supported by SSX. * @param address - User address. * @param resolveEnsOpts - Options to resolve ENS. * @returns Object containing ENS data. */ resolveEns: (address: string, resolveEnsOpts?: SSXEnsResolveOptions) => Promise; /** * Resolves Lens profiles owned by the given Ethereum Address. Each request is * limited by 10. To get other pages you must to pass the pageCursor parameter. * * Lens profiles can be resolved on the Polygon Mainnet (matic) or Mumbai Testnet * (maticmum). Visit https://docs.lens.xyz/docs/api-links for more information. * * @param address - Ethereum User address. * @param pageCursor - Page cursor used to paginate the request. Default to * first page. Visit https://docs.lens.xyz/docs/get-profiles#api-details for more * information. * @returns Object containing Lens profiles items and pagination info. */ resolveLens(address: string, pageCursor?: string): Promise; /** * Logs out the user by deleting the session. * Currently this is a no-op. * @param destroySession - Method to remove session from storage. * @returns Promise with true (success) or false (fail). */ logout: (destroySession?: () => Promise) => Promise; /** * Gets Express Session config params to configure the session. * @returns Session options. */ getExpressSessionConfig: () => SessionOptions; /** * Gets default Express Session Config. * @returns Default session options */ protected getDefaultExpressSessionConfig: () => SessionOptions; } //# sourceMappingURL=server.d.ts.map