UNPKG

lightning-auth-and-payment

Version:

Lightning Network authentication and payment processing library for modern web applications

209 lines 5.2 kB
export interface SessionData { userId: string; lnPubkey?: string; } export interface BTCPayInvoice { id: string; storeId: string; amount: string; currency: string; type: string; checkoutLink: string; status: string; createdTime: number; expirationTime: number; monitoringExpiration: number; metadata: Record<string, any>; checkout: { speedPolicy: string; paymentMethods: string[]; defaultPaymentMethod: string; expirationMinutes: number; monitoringMinutes: number; paymentTolerance: number; redirectURL: string; redirectAutomatically: boolean; requiresRefundEmail: boolean; checkoutType: string; }; receipt: { enabled: boolean; showQR: boolean; showPayments: boolean; }; } export interface CreateInvoiceRequest { amount: string; currency: string; orderId?: string; buyerEmail?: string; notificationURL?: string; redirectURL?: string; metadata?: Record<string, any>; } export interface WebhookPayload { deliveryId: string; webhookId: string; originalDeliveryId: string; isRedelivery: boolean; type: string; timestamp: number; storeId: string; invoiceId: string; overriddenStatus?: string; afterExpiration?: boolean; manuallyMarked?: boolean; paymentMethod?: string; payment?: { id: string; receivedDate: number; value: string; fee: string; status: string; destination: string; }; } export interface LoginInfo { userId: string; token: string; timestamp: number; } export interface ChallengeEntry { timestamp: number; isAuthorized?: boolean; linkingKey?: string; authorizedAt?: number; } export interface AuthConfig { sessionSecret: string; sessionCookieDomain?: string; baseUrl?: string; isProduction?: boolean; } export interface BTCPayConfig { host: string; storeId: string; apiKey: string; webhookSecret: string; } export interface LnurlStore { addChallenge(k1: string): Promise<void>; hasChallenge(k1: string): Promise<boolean>; completeLogin(k1: string, userId: string, token: string): Promise<void>; consumeLogin(k1: string): Promise<LoginInfo | null>; markAuthorized?(k1: string, linkingKey: string): Promise<void>; getStatus?(k1: string): Promise<"pending" | "authorized" | "expired">; challengeCount(): Promise<number>; } export interface DatabaseAdapter { user: { findUnique: (args: { where: { lnPubkey: string; }; }) => Promise<any>; create: (args: { data: { lnPubkey: string; }; }) => Promise<any>; }; session: { create: (args: { data: { userId: string; token: string; expiresAt: Date; }; }) => Promise<any>; deleteMany: (args: { where: { userId: string; }; }) => Promise<any>; }; invoice: { findUnique: (args: { where: { btcpayInvoiceId: string; }; }) => Promise<any>; update: (args: { where: { id: string; }; data: any; }) => Promise<any>; create: (args: { data: any; }) => Promise<any>; }; series: { findUnique: (args: { where: { slug: string; isActive: boolean; }; }) => Promise<any>; }; lnurlChallenge: { create: (args: { data: { k1: string; expiresAt: Date; }; }) => Promise<any>; findUnique: (args: { where: { k1: string; }; }) => Promise<any>; update: (args: { where: { k1: string; }; data: any; }) => Promise<any>; delete: (args: { where: { k1: string; }; }) => Promise<any>; deleteMany: (args: { where: any; }) => Promise<any>; count: () => Promise<number>; }; lnurlLogin: { create: (args: { data: { k1: string; userId: string; token: string; expiresAt: Date; }; }) => Promise<any>; findUnique: (args: { where: { k1: string; }; }) => Promise<any>; upsert: (args: { where: { k1: string; }; update: any; create: any; }) => Promise<any>; delete: (args: { where: { k1: string; }; }) => Promise<any>; deleteMany: (args: { where: any; }) => Promise<any>; }; $transaction: (operations: any[]) => Promise<any>; } //# sourceMappingURL=index.d.ts.map