import type { CookieRef } from 'nuxt/app'; import { FetchError } from 'ofetch'; import type { ComputedRef } from 'vue'; import type { AuthStore } from '../storage/stores/auth/auth-store.js'; import { CwaUserRoles } from '../storage/stores/auth/state.js'; import type { CwaUser } from '../storage/stores/auth/state.js'; import type { ResourcesStore } from '../storage/stores/resources/resources-store.js'; import type { FetcherStore } from '../storage/stores/fetcher/fetcher-store.js'; import type CwaFetch from './fetcher/cwa-fetch.js'; import type Mercure from './mercure.js'; import type Fetcher from './fetcher/fetcher.js'; import type Admin from '#cwa/admin/admin'; import type ApiDocumentation from '#cwa/api/api-documentation'; interface Credentials { username: string; password: string; } export declare enum CwaAuthStatus { SIGNED_OUT = 0, LOADING = 1, SIGNED_IN = 2 } interface BaseTokenUserEvent { username: string; token: string; } interface ConfirmNewEmailEvent extends BaseTokenUserEvent { newEmail: string; } interface ResetPasswordEvent extends BaseTokenUserEvent { username: string; token: string; passwords: { first: string; second: string; }; } export default class Auth { private readonly cwaFetch; private readonly mercure; private readonly fetcher; private readonly admin; private readonly apiDocumentation; private readonly authCookie; private loading; private hasCheckedMeEndpointForInit; private sessionEndHandler?; private readonly _authStore; private readonly _resourcesStore; private readonly _fetcherStore; private readonly nuxtApp; constructor(cwaFetch: CwaFetch, mercure: Mercure, fetcher: Fetcher, admin: Admin, apiDocumentation: ApiDocumentation, authStoreDefinition: AuthStore, resourcesStoreDefinition: ResourcesStore, fetcherStoreDefinition: FetcherStore, authCookie: CookieRef); signIn(credentials: Credentials): Promise | undefined>; forgotPassword(username: string): Promise; resendVerifyEmail(username: string): Promise; resendVerifyNewEmail(username: string): Promise; confirmEmail(event: ConfirmNewEmailEvent): Promise; verifyEmail(event: BaseTokenUserEvent): Promise; resetPassword(event: ResetPasswordEvent): Promise; signOut(): Promise; refreshUser(): Promise | undefined>; init(): Promise; get user(): { [x: string]: any; emailAddress: string; enabled: boolean; roles: (string | CwaUserRoles)[]; username: string; '@id': string; '@type': string; publishedResource?: string | undefined; draftResource?: string | undefined; uiComponent?: string | undefined; sortValue?: number | undefined; componentGroup?: string | undefined; _metadata: { [x: string]: any; adding?: { instantAdd: boolean; endpoint: string; isPublishable: boolean; } | undefined; persisted: boolean; publishable?: { published: boolean; publishedAt: string; } | undefined; sortDisplayNumber?: number | undefined; }; } | undefined; get roles(): string[] | undefined; get signedIn(): ComputedRef; hasRole(role: CwaUserRoles | string): boolean; get isAdmin(): ComputedRef; onSessionEnd(handler: () => unknown): void; private notifySessionEnded; private loginRequest; get status(): ComputedRef; private clearSession; private get authStore(); private get resourcesStore(); private get fetcherStore(); } export {};