UNPKG

bigblocks

Version:

Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React

68 lines 3.3 kB
import { type BigBlocksAuthOptions } from "../bigblocks-core.js"; export interface ExpressBigBlocksOptions extends BigBlocksAuthOptions { enableMiddleware?: boolean; enableCORS?: boolean; corsOptions?: { origin?: string | string[]; credentials?: boolean; }; } interface NodeRequest { method?: string; url?: string; headers: Record<string, string | string[] | undefined>; body?: string | Buffer | object; } interface NodeResponse { status(code: number): NodeResponse; setHeader(name: string, value: string): NodeResponse; json(obj: unknown): void; send(data: string | Buffer | object): void; end(): void; } /** * Creates BigBlocks auth handlers for Express and Node.js frameworks * Compatible with Express, Connect, Fastify, and others */ export declare function createExpressBigBlocks(options?: ExpressBigBlocksOptions): { handler: (req: NodeRequest, res: NodeResponse) => Promise<void>; middleware: (req: NodeRequest & { user?: import("../types.js").AuthUser; }, res: NodeResponse, next: () => void) => Promise<void>; router: (basePath?: string) => { path: string; handler: (req: NodeRequest, res: NodeResponse) => Promise<void>; }; api: { verifyAuth: (payload: import("../bigblocks-core.js").BigBlocksAuthPayload) => Promise<import("../bigblocks-core.js").BigBlocksAuthResult>; getSession: (headers: Headers) => Promise<import("../bigblocks-core.js").BigBlocksSession | null>; generateBackup: () => import("bitcoin-backup").BapMasterBackup; encryptBackup: (backup: import("bitcoin-backup").DecryptedBackup, password: string) => Promise<string>; decryptBackup: (encryptedBackup: string, password: string) => Promise<import("bitcoin-backup").DecryptedBackup>; }; options: import("../bigblocks-core.js").BigBlocksInternalConfig; }; export declare function mountBigBlocks(app: { use: (path: string, handler: (req: NodeRequest, res: NodeResponse, next?: () => void) => void) => void; }, options?: ExpressBigBlocksOptions): { handler: (req: NodeRequest, res: NodeResponse) => Promise<void>; middleware: (req: NodeRequest & { user?: import("../types.js").AuthUser; }, res: NodeResponse, next: () => void) => Promise<void>; router: (basePath?: string) => { path: string; handler: (req: NodeRequest, res: NodeResponse) => Promise<void>; }; api: { verifyAuth: (payload: import("../bigblocks-core.js").BigBlocksAuthPayload) => Promise<import("../bigblocks-core.js").BigBlocksAuthResult>; getSession: (headers: Headers) => Promise<import("../bigblocks-core.js").BigBlocksSession | null>; generateBackup: () => import("bitcoin-backup").BapMasterBackup; encryptBackup: (backup: import("bitcoin-backup").DecryptedBackup, password: string) => Promise<string>; decryptBackup: (encryptedBackup: string, password: string) => Promise<import("bitcoin-backup").DecryptedBackup>; }; options: import("../bigblocks-core.js").BigBlocksInternalConfig; }; export type ExpressBigBlocksHandler = ReturnType<typeof createExpressBigBlocks>; export type ExpressMiddleware = ExpressBigBlocksHandler["middleware"]; export {}; //# sourceMappingURL=express.d.ts.map