mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 23:03:32 +00:00
[PM-5499] auth request service migrations (#8597)
* move auth request storage to service * create migrations for auth requests * fix tests * fix browser * fix login strategy * update migration * use correct test descriptions in migration
This commit is contained in:
@@ -1,12 +1,52 @@
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { AdminAuthRequestStorable } from "@bitwarden/common/auth/models/domain/admin-auth-req-storable";
|
||||
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
|
||||
import { AuthRequestPushNotification } from "@bitwarden/common/models/response/notification.response";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { UserKey, MasterKey } from "@bitwarden/common/types/key";
|
||||
|
||||
export abstract class AuthRequestServiceAbstraction {
|
||||
/** Emits an auth request id when an auth request has been approved. */
|
||||
authRequestPushNotification$: Observable<string>;
|
||||
|
||||
/**
|
||||
* Returns true if the user has chosen to allow auth requests to show on this client.
|
||||
* Intended to prevent spamming the user with auth requests.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract getAcceptAuthRequests: (userId: UserId) => Promise<boolean>;
|
||||
/**
|
||||
* Sets whether to allow auth requests to show on this client for this user.
|
||||
* @param accept Whether to allow auth requests to show on this client.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract setAcceptAuthRequests: (accept: boolean, userId: UserId) => Promise<void>;
|
||||
/**
|
||||
* Returns an admin auth request for the given user if it exists.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract getAdminAuthRequest: (userId: UserId) => Promise<AdminAuthRequestStorable | null>;
|
||||
/**
|
||||
* Sets an admin auth request for the given user.
|
||||
* Note: use {@link clearAdminAuthRequest} to clear the request.
|
||||
* @param authRequest The admin auth request.
|
||||
* @param userId The user id.
|
||||
* @throws If `authRequest` or `userId` is not provided.
|
||||
*/
|
||||
abstract setAdminAuthRequest: (
|
||||
authRequest: AdminAuthRequestStorable,
|
||||
userId: UserId,
|
||||
) => Promise<void>;
|
||||
/**
|
||||
* Clears an admin auth request for the given user.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract clearAdminAuthRequest: (userId: UserId) => Promise<void>;
|
||||
/**
|
||||
* Approve or deny an auth request.
|
||||
* @param approve True to approve, false to deny.
|
||||
|
||||
Reference in New Issue
Block a user