import { IdTokenClaims, UserinfoResponse } from 'openid-client'; import { FC, ComponentType, ReactElement } from 'react'; interface CreateLogoutUrlOptions { /** * The path to which you would like to return after the logout flow */ returnTo?: string; } interface ClientAuthAuthenticated { isAuthenticated: true; credentials: { audience?: string; claims: IdTokenClaims; scope: string[]; user: UserinfoResponse; idToken: string; accessToken: string; }; loginUrl: string; logoutUrl: string; } interface ClientAuthAuthenticatedApi extends ClientAuthAuthenticated { createLoginUrl(options?: CreateLoginUrlOptions): string; createLogoutUrl(options?: CreateLogoutUrlOptions): string; } interface CreateLoginUrlOptions { /** * The audience (aud claim) for which you wish to obtain an access token */ audience?: string; /** * The path to which you would like to return after the login flow */ returnTo?: string; /** * A set of scopes to request */ scope?: string[]; } interface ClientAuthUnauthenticated { isAuthenticated: false; error?: unknown; loginUrl: string; logoutUrl: string; } interface ClientAuthUnauthenticatedApi extends ClientAuthUnauthenticated { createLoginUrl(options?: CreateLoginUrlOptions): string; } declare type ClientAuth = ClientAuthAuthenticated | ClientAuthUnauthenticated; declare type ClientAuthApi = ClientAuthAuthenticatedApi | ClientAuthUnauthenticatedApi; declare function useAuth(): ClientAuthAuthenticatedApi | ClientAuthUnauthenticatedApi; interface UseRequiredAuthOptions { audience?: string; scope?: string[]; } declare function useAuthorized(options?: UseRequiredAuthOptions): ClientAuth & { isAuthorized: boolean; }; interface WithAuthenticationRequiredOptions { audience?: string; fallback?: FC<{ loginUrl: string; }>; scope?: string[]; } declare function withAuthenticationRequired

(Component: ComponentType

, options?: WithAuthenticationRequiredOptions): (props: P) => ReactElement | null; declare type NostalgieUser = UserinfoResponse; export { ClientAuth, ClientAuthApi, ClientAuthAuthenticated, ClientAuthAuthenticatedApi, ClientAuthUnauthenticated, ClientAuthUnauthenticatedApi, CreateLoginUrlOptions, CreateLogoutUrlOptions, NostalgieUser, UseRequiredAuthOptions, WithAuthenticationRequiredOptions, useAuth, useAuthorized, withAuthenticationRequired };