Files
vitanovaPackages/dist/ed25519/auth.service.d.ts
2026-08-18 01:55:26 +04:00

36 lines
1.4 KiB
TypeScript

import { Observable } from 'rxjs';
import { AuthTokenPair } from './models/auth-api.model';
import { AuthError } from './models/auth-error.model';
export type LoginPhase = 'idle' | 'requesting-challenge' | 'signing' | 'verifying' | 'done';
/**
* Orchestrates the Ed25519 challenge/response admin auth flow end to end:
*
* GET /api/admin/auth/challenge -> { nonce }
* sign(nonce) with local Ed25519 key -> signature
* POST /api/admin/auth/verify -> { token, refreshToken }
*
* This is the lowest-level orchestrator; components should go through
* AuthFacade rather than calling this directly. Exported from the package
* barrel as `Ed25519AuthService` to avoid colliding with the telegram
* module's `AuthService`.
*/
export declare class AuthService {
private readonly api;
private readonly keypair;
private readonly session;
private readonly loginPhaseSignal;
private readonly lastErrorSignal;
readonly loginPhase: import("@angular/core").Signal<LoginPhase>;
readonly lastError: import("@angular/core").Signal<AuthError | null>;
constructor();
/** Restores a persisted session on app bootstrap. Call once from an APP_INITIALIZER or root component. */
restoreSession(): void;
login(): Observable<AuthTokenPair>;
refresh(): Observable<AuthTokenPair>;
logout(): Observable<void>;
private signChallenge;
private handleAuthError;
private toAuthErrorShape;
private toAuthError;
}