45 lines
2.1 KiB
TypeScript
45 lines
2.1 KiB
TypeScript
import { Observable } from 'rxjs';
|
|
import { AdminAuthStatus, AuthSession, WebSessionStart } from './models/session.model';
|
|
export declare class AdminAuthService {
|
|
private readonly api;
|
|
private readonly sessionSignal;
|
|
private readonly statusSignal;
|
|
private readonly showLoginSignal;
|
|
readonly session: import("@angular/core").Signal<AuthSession | null>;
|
|
readonly status: import("@angular/core").Signal<AdminAuthStatus>;
|
|
readonly isAuthenticated: import("@angular/core").Signal<boolean>;
|
|
readonly showLoginDialog: import("@angular/core").Signal<boolean>;
|
|
readonly displayName: import("@angular/core").Signal<string | null>;
|
|
private sessionCheckTimer?;
|
|
constructor();
|
|
checkSession(): void;
|
|
/** Check session without mutating internal state beyond activating on success (used for polling). */
|
|
checkSessionOnce(webSessionID?: string | null): Observable<AuthSession | null>;
|
|
/** Create a backend web session - identical call to the customer login (TelegramSessionApiService.createSession). */
|
|
createWebSession(): Observable<WebSessionStart>;
|
|
getAdminAppLoginUrl(webSessionID: string): string;
|
|
onLoginComplete(): void;
|
|
requestLogin(): void;
|
|
/**
|
|
* Dev-only shortcut for local testing without a reachable Telegram/session
|
|
* backend: fabricates a local session and activates it directly, skipping
|
|
* the QR flow entirely. No-ops in production builds (checked via Angular's
|
|
* isDevMode() at runtime, not just build-time, so it is safe even if this
|
|
* code ships). Never call this from anywhere reachable in a production build.
|
|
*/
|
|
devBypassLogin(): void;
|
|
hideLogin(): void;
|
|
logout(): void;
|
|
/** JWT pair storage, reserved for once the backend issues admin access/refresh tokens. Unused until then. */
|
|
getAdminToken(): string | null;
|
|
setAdminTokens(token: string, refreshToken: string): void;
|
|
clearAdminTokens(): void;
|
|
private activateSession;
|
|
private clearAuthState;
|
|
private scheduleSessionRefresh;
|
|
private clearSessionRefresh;
|
|
private getStoredAdminSessionID;
|
|
private setStoredAdminSessionID;
|
|
private clearStoredAdminSessionID;
|
|
}
|