bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
51 lines • 1.78 kB
TypeScript
type RequestType = globalThis.Request;
type ResponseType = globalThis.Response;
type HeadersType = globalThis.Headers;
import { type BapMasterBackup, type DecryptedBackup } from "bitcoin-backup";
import type { AuthUser, BitcoinAuthConfig, StorageAdapter } from "../lib/types.js";
export interface BigBlocksAuthOptions {
verifySignatures?: boolean;
timeWindow?: number;
bodyEncoding?: "hex" | "base64" | "utf8";
basePath?: string;
storage?: StorageAdapter;
storageNamespace?: string;
backupTypes?: BitcoinAuthConfig["backupTypes"];
}
export interface BigBlocksInternalConfig extends Required<BigBlocksAuthOptions> {
}
export interface BigBlocksAuthPayload {
address: string;
idKey: string;
authToken: string;
requestPath: string;
body: string;
timestamp?: string;
}
export interface BigBlocksAuthResult {
success: boolean;
user?: AuthUser;
error?: string;
}
export interface BigBlocksSession {
user: AuthUser;
sessionId: string;
expiresAt: Date;
}
/**
* Creates a BigBlocks authentication instance
* Following Better Auth pattern with universal handler
*/
export declare function createBigBlocksAuth(options?: BigBlocksAuthOptions): {
handler: (request: RequestType) => Promise<ResponseType>;
api: {
verifyAuth: (payload: BigBlocksAuthPayload) => Promise<BigBlocksAuthResult>;
getSession: (headers: HeadersType) => Promise<BigBlocksSession | null>;
generateBackup: () => BapMasterBackup;
encryptBackup: (backup: DecryptedBackup, password: string) => Promise<string>;
decryptBackup: (encryptedBackup: string, password: string) => Promise<DecryptedBackup>;
};
options: BigBlocksInternalConfig;
};
export {};
//# sourceMappingURL=bigblocks-core.d.ts.map