UNPKG

@narangcia-oss/cryptic-auth-client-plain-ts

Version:

A TypeScript client for interacting with a cryptic-auth host web server, crafted by Narangcia OSS.

44 lines (43 loc) 1.34 kB
import type { AuthTokens } from "../types"; export interface OAuth2FragmentResult { success: boolean; tokens?: AuthTokens; error?: string; errorDescription?: string; } /** * OAuth2 Fragment Handler for processing tokens from URL fragments * This handles the new OAuth2 flow where the backend redirects to frontend with tokens */ export declare class OAuth2FragmentHandler { private static hasProcessed; private static currentFragment; /** * Checks if the current URL contains OAuth2 fragment parameters */ static isOAuth2Fragment(): boolean; /** * Resets the processing state (for testing or manual reset) */ static resetProcessingState(): void; /** * Processes OAuth2 tokens from URL fragment */ static processFragment(): OAuth2FragmentResult; /** * Clears OAuth2 parameters from URL fragment for security */ static clearFragment(): void; /** * Complete OAuth2 fragment processing - process and clean up */ static processAndClear(): OAuth2FragmentResult; } /** * Utility function to check if current page is an OAuth2 callback */ export declare function isOAuth2Callback(): boolean; /** * Utility function to extract OAuth2 tokens from URL fragment */ export declare function extractOAuth2Tokens(): OAuth2FragmentResult;