Skip to content

Commit

Permalink
Merge pull request #812 from magiclabs/sherzod-PDEEXP-1711-disable-mf…
Browse files Browse the repository at this point in the history
…a-flow-types

feat: implement disable MFA types
  • Loading branch information
Ethella authored Sep 16, 2024
2 parents ac27bfa + 128360e commit 928e0c1
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions packages/@magic-sdk/types/src/modules/auth-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,24 @@ export interface LoginWithCredentialConfiguration {
lifespan?: number;
}

export interface EnableMfaConfiguration {
export interface EnableMFAConfiguration {
/**
* When `true`, a pre-built modal interface will show to the user, directing
* them to enable MFA usign Google Authenticator app.
*
* When `false`, developers will be able to implement their own custom UI to
* continue the SMS OTP flow.
* continue the enable MFA flow.
*/
showUI?: boolean;
}

export interface DisableMFAConfiguration {
/**
* When `true`, a pre-built modal interface will show to the user, directing
* them to disable MFA.
*
* When `false`, developers will be able to implement their own custom UI to
* continue the disable MFA flow.
*/
showUI?: boolean;
}
Expand Down Expand Up @@ -224,6 +235,18 @@ export enum EnableMFAEventEmit {
Cancel = 'cancel-mfa-setup',
}

export enum DisableMFAEventOnReceived {
MFACodeRequested = 'mfa-code-requested',
InvalidMFAOtp = 'invalid-mfa-otp',
InvalidRecoveryCode = 'invalid-recovery-code',
}

export enum DisableMFAEventEmit {
VerifyMFACode = 'verify-mfa-code',
LostDevice = 'lost-device',
Cancel = 'cancel-mfa-disable',
}

/**
* EventHandlers
*/
Expand Down Expand Up @@ -322,3 +345,13 @@ export type EnableMFAEventHandlers = {
[EnableMFAEventEmit.VerifyMFACode]: (totp: string) => void;
[EnableMFAEventEmit.Cancel]: () => void;
};

/**
* Disable MFA
*/

export type DisableMFAEventHandlers = {
[DisableMFAEventOnReceived.MFACodeRequested]: () => void;
[DisableMFAEventOnReceived.InvalidMFAOtp]: (error: string) => void;
[DisableMFAEventOnReceived.InvalidRecoveryCode]: () => void;
};

0 comments on commit 928e0c1

Please sign in to comment.