import type { Context, Hono } from 'hono'; import { StorageAdapter } from '../storage/storage.js'; export type ProviderRoute = Hono; export interface Provider { type: string; init: (route: ProviderRoute, options: ProviderOptions) => void; client?: (input: { clientID: string; clientSecret: string; params: Record; }) => Promise; } export interface ProviderOptions { name: string; success: ( ctx: Context, properties: Properties, opts?: { invalidate?: (subject: string) => Promise; } ) => Promise; forward: (ctx: Context, response: Response) => Response; set: (ctx: Context, key: string, maxAge: number, value: T) => Promise; get: (ctx: Context, key: string) => Promise; unset: (ctx: Context, key: string) => Promise; invalidate: (subject: string) => Promise; storage: StorageAdapter; } export class ProviderError extends Error {} export class ProviderUnknownError extends ProviderError {}