UNPKG

better-auth-compliance

Version:

Regional compliance and privacy plugin for Better Auth - GDPR, CCPA, and data protection automation

48 lines (46 loc) 1.31 kB
import type { BetterAuthClientPlugin } from "better-auth/client"; export interface ConsentPreferences { cookies?: { necessary?: boolean; analytics?: boolean; marketing?: boolean; }; dataProcessing?: boolean; } export const complianceClient = (): BetterAuthClientPlugin => { return { id: "compliance", $InferServerPlugin: {} as any, getActions: () => ({ compliance: { updateConsent: async (preferences: ConsentPreferences) => { // TODO: Update consent preferences return { success: true }; }, requestDataExport: async () => { // TODO: Request data export return { requestId: "", status: "pending" }; }, requestDeletion: async () => { // TODO: Request account deletion return { requestId: "", status: "pending" }; }, getComplianceStatus: async () => { // TODO: Get compliance status return { consents: {}, rights: {}, region: "us" }; }, verifyAge: async (verification: { birthDate: string; parentEmail?: string; }) => { // TODO: Verify age return { verified: true, requiresConsent: false }; } } }) }; };