Skip to content

Commit

Permalink
Merge pull request #803 from magiclabs/sherzod-PDEEXP-1711-Support-MF…
Browse files Browse the repository at this point in the history
…A-setup-whitelabel-support

feat: implement new events for MFA whitelabel
  • Loading branch information
Ethella authored Sep 11, 2024
2 parents 3f2601f + d223a9e commit c1008ee
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/@magic-sdk/types/src/modules/auth-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ export interface LoginWithCredentialConfiguration {
lifespan?: number;
}

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.
*/
showUI?: boolean;
}

/**
* Auth Events Enum
*/
Expand Down Expand Up @@ -203,6 +214,16 @@ export enum FarcasterLoginEventEmit {
SuccessSignIn = 'Farcaster/success_sign_in',
}

export enum EnableMFAEventOnReceived {
MFASecretGenerated = 'mfa-secret-generated',
InvalidMFAOtp = 'invalid-mfa-otp',
MFARecoveryCodes = 'mfa-recovery-codes',
}
export enum EnableMFAEventEmit {
VerifyMFACode = 'verify-mfa-code',
Cancel = 'cancel-mfa-setup',
}

/**
* EventHandlers
*/
Expand Down Expand Up @@ -286,3 +307,18 @@ export type UpdateEmailEventHandlers = {
[UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void;
[UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void;
} & RecencyCheckEventHandlers;

/**
* Enable MFA
*/

export type EnableMFAEventHandlers = {
// Event Received
[EnableMFAEventOnReceived.MFASecretGenerated]: (QRCode: string, key: string) => void;
[EnableMFAEventOnReceived.InvalidMFAOtp]: (error: string) => void;
[EnableMFAEventOnReceived.MFARecoveryCodes]: (recoveryCodes: string) => void;

// Event sent
[EnableMFAEventEmit.VerifyMFACode]: (totp: string) => void;
[EnableMFAEventEmit.Cancel]: () => void;
};

0 comments on commit c1008ee

Please sign in to comment.