forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstate.ts
More file actions
41 lines (32 loc) · 1.65 KB
/
Copy pathstate.ts
File metadata and controls
41 lines (32 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type {MultifactorAuthenticationScenarioResponse} from '@components/MultifactorAuthentication/config/types';
import type {AuthenticationChallenge} from '@libs/MultifactorAuthentication/shared/challengeTypes';
import type {AuthTypeInfo} from '@libs/MultifactorAuthentication/shared/types';
/**
* The reducer's MFA state shape: the fields not yet migrated to the state machine. Migrated fields
* live in the machine context (`MfaContext`); the machine side is exposed to consumers as `MfaState`
* via `snapshotToState`.
*/
type MultifactorAuthenticationState = {
/** Challenge received from backend for authorization (full object with allowCredentials, rpId, challenge) */
authorizationChallenge: AuthenticationChallenge | undefined;
/** Whether registration step has been completed */
isRegistrationComplete: boolean;
/** Whether authorization step has been completed */
isAuthorizationComplete: boolean;
/** Whether the entire flow has been completed */
isFlowComplete: boolean;
/** Authentication method used (e.g., 'BIOMETRIC_FACE', 'BIOMETRIC_FINGERPRINT') */
authenticationMethod: AuthTypeInfo | undefined;
/** Response from the scenario API call, stored for callback invocation at outcome navigation */
scenarioResponse: MultifactorAuthenticationScenarioResponse | undefined;
};
const DEFAULT_STATE: MultifactorAuthenticationState = {
authorizationChallenge: undefined,
isRegistrationComplete: false,
isAuthorizationComplete: false,
isFlowComplete: false,
authenticationMethod: undefined,
scenarioResponse: undefined,
};
export type {MultifactorAuthenticationState};
export {DEFAULT_STATE};