50 lines
2.2 KiB
TypeScript
50 lines
2.2 KiB
TypeScript
|
|
import { Observable } from 'rxjs';
|
||
|
|
import { AuthSession, AuthStatus, WebSessionStart } from './models/session.model';
|
||
|
|
/** Customer-facing Telegram QR/session auth. Distinct storage/state from AdminAuthService by design. */
|
||
|
|
export declare class AuthService {
|
||
|
|
private readonly api;
|
||
|
|
private sessionSignal;
|
||
|
|
private statusSignal;
|
||
|
|
private showLoginSignal;
|
||
|
|
/** Current auth session */
|
||
|
|
readonly session: import("@angular/core").Signal<AuthSession | null>;
|
||
|
|
/** Current auth status */
|
||
|
|
readonly status: import("@angular/core").Signal<AuthStatus>;
|
||
|
|
/** Whether user is fully authenticated */
|
||
|
|
readonly isAuthenticated: import("@angular/core").Signal<boolean>;
|
||
|
|
/** Whether to show login dialog */
|
||
|
|
readonly showLoginDialog: import("@angular/core").Signal<boolean>;
|
||
|
|
/** Display name of authenticated user */
|
||
|
|
readonly displayName: import("@angular/core").Signal<string | null>;
|
||
|
|
private sessionCheckTimer?;
|
||
|
|
constructor();
|
||
|
|
/** Check the current webSessionID cookie against the auth backend. */
|
||
|
|
checkSession(): void;
|
||
|
|
/** Check session without updating internal state beyond activating on success (used for polling). */
|
||
|
|
checkSessionOnce(webSessionID?: string | null): Observable<AuthSession | null>;
|
||
|
|
/**
|
||
|
|
* Called after user completes Telegram login.
|
||
|
|
*/
|
||
|
|
onTelegramLoginComplete(): void;
|
||
|
|
/** Generate the Telegram login URL for bot-based auth */
|
||
|
|
getTelegramLoginUrl(webSessionID: string): string;
|
||
|
|
/** Generate a Telegram app deep link for mobile login without opening a browser tab. */
|
||
|
|
getTelegramAppLoginUrl(webSessionID: string): string;
|
||
|
|
/** Create a backend web session and return the Telegram start link for it. */
|
||
|
|
createWebSession(): Observable<WebSessionStart>;
|
||
|
|
/** Show login dialog (called when user tries to pay without being logged in) */
|
||
|
|
requestLogin(): void;
|
||
|
|
/** Hide login dialog */
|
||
|
|
hideLogin(): void;
|
||
|
|
/** Logout — clears session on backend and locally */
|
||
|
|
logout(): void;
|
||
|
|
private activateSession;
|
||
|
|
private clearAuthState;
|
||
|
|
/** Schedule a session re-check before it expires */
|
||
|
|
private scheduleSessionRefresh;
|
||
|
|
private clearSessionRefresh;
|
||
|
|
private getStoredWebSessionID;
|
||
|
|
private setStoredWebSessionID;
|
||
|
|
private clearStoredWebSessionID;
|
||
|
|
}
|