bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
69 lines • 3.14 kB
TypeScript
import { type BigBlocksAuthOptions } from "../bigblocks-core.js";
export interface NextJSBigBlocksOptions extends BigBlocksAuthOptions {
enableMiddleware?: boolean;
enablePages?: boolean;
enableAppDir?: boolean;
}
interface NextRequestType {
url: string;
method: string;
headers: globalThis.Headers;
body: globalThis.ReadableStream<Uint8Array> | null;
nextUrl: {
pathname: string;
};
}
/**
* Creates BigBlocks auth handlers for Next.js
* Works with both Pages Router (/pages/api) and App Router (/app/api)
*/
export declare function createNextJSBigBlocks(options?: NextJSBigBlocksOptions): {
GET: (request: NextRequestType | globalThis.Request) => Promise<any>;
POST: (request: NextRequestType | globalThis.Request) => Promise<any>;
PUT: (request: NextRequestType | globalThis.Request) => Promise<any>;
DELETE: (request: NextRequestType | globalThis.Request) => Promise<any>;
handler: (req: {
headers: Record<string, string>;
url?: string;
method: string;
body?: unknown;
}, res: {
status: (code: number) => {
json: (data: unknown) => void;
};
setHeader: (key: string, value: string) => void;
send: (body: string) => void;
}) => Promise<void>;
middleware: (request: NextRequestType | globalThis.Request) => Promise<any>;
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 const createAppRouterHandlers: (options?: NextJSBigBlocksOptions) => {
GET: (request: NextRequestType | globalThis.Request) => Promise<any>;
POST: (request: NextRequestType | globalThis.Request) => Promise<any>;
PUT: (request: NextRequestType | globalThis.Request) => Promise<any>;
DELETE: (request: NextRequestType | globalThis.Request) => Promise<any>;
};
export declare const createPagesAPIHandler: (options?: NextJSBigBlocksOptions) => (req: {
headers: Record<string, string>;
url?: string;
method: string;
body?: unknown;
}, res: {
status: (code: number) => {
json: (data: unknown) => void;
};
setHeader: (key: string, value: string) => void;
send: (body: string) => void;
}) => Promise<void>;
export declare const createNextMiddleware: (options?: NextJSBigBlocksOptions) => (request: NextRequestType | globalThis.Request) => Promise<any>;
export type NextJSBigBlocksHandler = ReturnType<typeof createNextJSBigBlocks>;
export type NextJSMiddleware = NextJSBigBlocksHandler["middleware"];
export {};
//# sourceMappingURL=nextjs.d.ts.map