import type { ProviderInterface } from './types'; /** Is `name` a provider this package can drive? */ export declare function isSocialProviderName(name: unknown): name is SocialProviderName; /** * Does this provider have everything it needs to complete a sign-in? * * Never throws, so it is safe to call while rendering. An unknown name is * simply not configured. */ export declare function isSocialProviderConfigured(name: unknown): boolean; /** * Every provider that would work if a visitor clicked it, in the order * they are declared above. Render sign-in buttons straight off this and a * half-configured provider never reaches a visitor as a dead button. */ export declare function configuredSocialProviders(): SocialProviderDescriptor[]; /** * Build a provider, or null when it is not configured. * * The whole `config.services[name]` block is passed to the driver, so * provider-specific fields (Apple's teamId, keyId and privateKey) arrive * rather than being dropped by a caller that only knew about clientId and * clientSecret. Returning null rather than throwing lets a route answer * 404 for an unconfigured provider instead of redirecting a visitor to a * provider error page that reads to them as the application's fault. */ export declare function socialProvider(name: unknown): ProviderInterface | null; declare const OAUTH2_REQUIRED: readonly ['clientId', 'clientSecret', 'redirectUrl']; export declare const SOCIAL_PROVIDERS: Readonly>; export declare interface SocialProviderDescriptor { name: SocialProviderName label: string driver: new (providerConfig: any) => ProviderInterface required: readonly string[] postCallback: boolean } /** * Which social providers are usable in this application right now. * * Every driver already knows what it needs, but only as a throw: each * `validateConfig()` raises a ConfigException part-way through an auth * flow. A sign-in page has the opposite question, and has to answer it * before rendering anything: which buttons will actually work? * * Without an answer here, applications hand-roll one, and the shape they * reach for is `clientId && clientSecret`, because that is true of every * provider except the one it is not true of. Apple has no static client * secret at all (the driver signs a short-lived ES256 JWT from teamId + * keyId + privateKey), so a hand-rolled check silently classifies a fully * configured Apple as absent, and Sign in with Apple never appears. * * The same registry drives construction, so a provider is built with the * whole of its config block rather than the three fields the OAuth2 * providers happen to share. */ export type SocialProviderName = 'apple' | 'facebook' | 'github' | 'google' | 'twitter';