1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Observable auth statuses (#8537)

* Observable has token

* Allow access to user key state observable

* Create observable auth status

* Fix DI
This commit is contained in:
Matt Gibson
2024-04-01 14:15:54 -05:00
committed by GitHub
parent c3c895230f
commit 136226b6be
12 changed files with 260 additions and 26 deletions

View File

@@ -1,10 +1,17 @@
import { Observable } from "rxjs";
import { UserId } from "../../types/guid";
import { AuthenticationStatus } from "../enums/authentication-status";
export abstract class AuthService {
/** Authentication status for the active user */
abstract activeAccountStatus$: Observable<AuthenticationStatus>;
/**
* Returns an observable authentication status for the given user id.
* @note userId is a required parameter, null values will always return `AuthenticationStatus.LoggedOut`
* @param userId The user id to check for an access token.
*/
abstract authStatusFor$(userId: UserId): Observable<AuthenticationStatus>;
/** @deprecated use {@link activeAccountStatus$} instead */
abstract getAuthStatus: (userId?: string) => Promise<AuthenticationStatus>;
abstract logOut: (callback: () => void) => void;