bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
56 lines • 2.41 kB
TypeScript
import { type BigBlocksAuthOptions } from "../bigblocks-core.js";
interface APIContext {
request: globalThis.Request;
params: Record<string, string | undefined>;
url: URL;
cookies: {
get: (name: string) => {
value: string;
} | undefined;
set: (name: string, value: string, options?: {
httpOnly?: boolean;
secure?: boolean;
sameSite?: "strict" | "lax" | "none";
maxAge?: number;
expires?: Date;
}) => void;
delete: (name: string) => void;
};
redirect: (url: string, status?: number) => globalThis.Response;
locals: Record<string, unknown>;
}
type APIRoute = (context: APIContext) => globalThis.Response | Promise<globalThis.Response>;
export interface AstroBigBlocksOptions extends BigBlocksAuthOptions {
enableMiddleware?: boolean;
enableAPIRoutes?: boolean;
}
/**
* Creates BigBlocks auth handlers for Astro
* Works with Astro API routes (/src/pages/api/auth/[...bigblocks].ts)
*/
export declare function createAstroBigBlocks(options?: AstroBigBlocksOptions): {
GET: APIRoute;
POST: APIRoute;
PUT: APIRoute;
DELETE: APIRoute;
middleware: (context: APIContext, next: () => Promise<globalThis.Response>) => Promise<Response>;
getSession: (context: APIContext) => Promise<import("../bigblocks-core.js").BigBlocksSession | null>;
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 createBigBlocksAPIRoute(options?: AstroBigBlocksOptions): {
GET: APIRoute;
POST: APIRoute;
PUT: APIRoute;
DELETE: APIRoute;
};
export type AstroBigBlocksHandler = ReturnType<typeof createAstroBigBlocks>;
export type AstroMiddleware = AstroBigBlocksHandler["middleware"];
export {};
//# sourceMappingURL=astro.d.ts.map