@@ -95,9 +95,11 @@ export interface AuthClient<T = AuthTokens, C = AuthCredentials> {
9595 onPreRefresh ?( ) : Promise < void > ;
9696
9797 /**
98- * Optional token refresh handler
99- * @param {number } [minValidity] - Minimum token validity period in seconds
100- * @returns {Promise<T> } - Returns refreshed authentication tokens
98+ * Optional token refresh handler.
99+ * Implement this method to handle token refresh logic.
100+ * @param {T } currentTokens - The current authentication tokens.
101+ * @param {number } [minValidity] - Optional minimum token validity period in seconds.
102+ * @returns {Promise<T> } - A promise that resolves with the refreshed authentication tokens.
101103 */
102104 onRefresh ?( currentTokens : T , minValidity ?: number ) : Promise < T > ;
103105
@@ -469,11 +471,16 @@ export type AuthProviderProps = PropsWithChildren<{
469471} > ;
470472
471473/**
472- * Creates an authentication context and provider for a React application
473- * @template AC - The AuthClient implementation type
474- * @template E - The error type used throughout the authentication flow
475- * @param authClient - The base authentication client to use
476- * @returns An object containing the AuthProvider component and useAuthClient hook
474+ * Creates an authentication context and provider for a React application.
475+ * It wraps the provided `authClient` with enhanced state management and event handling.
476+ *
477+ * @template AC - The type of the base `AuthClient` implementation.
478+ * @template E - The type of error expected during authentication flows. Defaults to `Error`.
479+ * @param {AC } authClient - The base authentication client instance to use.
480+ * @returns An object containing:
481+ * - `AuthProvider`: A React component to wrap the application or parts of it.
482+ * - `authClient`: The enhanced authentication client instance.
483+ * - `useAuthClient`: A hook to access the enhanced `authClient` within the `AuthProvider`.
477484 */
478485export function createAuth < AC extends AuthClient , E extends Error = Error > ( authClient : AC ) {
479486 // Create a React context containing an AuthClient instance.
0 commit comments